本文整理汇总了Java中android.support.test.espresso.intent.matcher.IntentMatchers类的典型用法代码示例。如果您正苦于以下问题:Java IntentMatchers类的具体用法?Java IntentMatchers怎么用?Java IntentMatchers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntentMatchers类属于android.support.test.espresso.intent.matcher包,在下文中一共展示了IntentMatchers类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldStartIntentWithCorrectUri
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void shouldStartIntentWithCorrectUri() throws UnsupportedEncodingException {
createFilterTestRule.launchActivity(new Intent(Intent.ACTION_MAIN));
String filterName = "MyTestFilter-" + UUID.randomUUID();
clickAddFilter();
setFilterData(filterName, "http://daverix.net/[email protected]&[email protected]", "@uri", "@subject");
saveUsingIdlingResource(getApplication());
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "http://example.com");
intent.putExtra(Intent.EXTRA_SUBJECT, "Example");
testRule.launchActivity(intent);
onData(withLinkFilter(filterName)).perform(click());
intended(allOf(IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData("http://daverix.net/test.php?url=" + URLEncoder.encode("http://example.com", "UTF-8") + "&subject=Example")));
}
开发者ID:daverix,项目名称:urlforwarder,代码行数:20,代码来源:LinkDialogActivityTest.java
示例2: shouldStartIntentWithCorrectUriWhenUriNotEncoded
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void shouldStartIntentWithCorrectUriWhenUriNotEncoded() throws UnsupportedEncodingException {
createFilterTestRule.launchActivity(new Intent(Intent.ACTION_MAIN));
String filterName = "MyTestFilter-" + UUID.randomUUID();
clickAddFilter();
setFilterData(filterName, "http://daverix.net/test/@uri", "@uri", "");
closeSoftKeyboard();
clickEncodeCheckbox();
saveUsingIdlingResource(getApplication());
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "http://example2.com");
testRule.launchActivity(intent);
onData(withLinkFilter(filterName)).perform(click());
intended(allOf(IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData("http://daverix.net/test/http://example2.com")));
}
开发者ID:daverix,项目名称:urlforwarder,代码行数:21,代码来源:LinkDialogActivityTest.java
示例3: speakerImage_WhenClicked_IntentFired
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void speakerImage_WhenClicked_IntentFired() {
Intent resultData = new Intent();
resultData.putExtras(new Bundle());
// Create the ActivityResult with the Intent.
Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));
// When clicking on speaker image
onView(withId(R.id.session_detail_frag)).perform(swipeUp());
onView(withId(R.id.speaker_image)).perform(click());
// Then the intent to display the speaker url is fired
Uri expectedSpeakerUri = Uri.parse(SpeakersMockCursor.FAKE_SPEAKER_URL);
intended(CoreMatchers.allOf(
hasAction(IsEqual.equalTo(Intent.ACTION_VIEW)),
hasData(expectedSpeakerUri)));
}
开发者ID:google,项目名称:iosched,代码行数:20,代码来源:SessionDetailActivity_InScheduleStarredSessionTest.java
示例4: youTubeVideo_WhenClicked_IntentFired
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void youTubeVideo_WhenClicked_IntentFired() {
Intent resultData = new Intent();
resultData.putExtras(new Bundle());
// Create the ActivityResult with the Intent.
Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));
// When clicking on video
onView(withId(R.id.watch)).perform(click());
// Then the intent to play the video is fired
IntentUtils.checkVideoIntentIsFired(SessionsMockCursor.FAKE_YOUTUBE_URL,
mActivityRule.getActivity(), false);
}
开发者ID:google,项目名称:iosched,代码行数:17,代码来源:SessionDetailActivity_EndedLiveStarredSessionTest.java
示例5: testContactPickerStubWithExtraMatcher
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void testContactPickerStubWithExtraMatcher() {
Uri dummyContactDataUri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, CONTACT_ID);
EspContactStub.register(dummyContactDataUri, Activity.RESULT_OK, IntentMatchers.hasExtraWithKey("MyKey"));
Intent contactPickerIntent = createContactPickerIntent();
contactPickerIntent.putExtra("MyKey", "myValue");
activity.startForResult(contactPickerIntent, REQUEST_CODE);
requestCodeTextView.assertTextIs(String.valueOf(REQUEST_CODE));
resultCodeTextView.assertTextIs(String.valueOf(Activity.RESULT_OK));
dataTextView.assertTextIs(dummyContactDataUri.toString());
}
开发者ID:nenick,项目名称:espresso-macchiato,代码行数:14,代码来源:EspContactStubTest.java
示例6: testWhenNotMatchingExtraMatcher
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
@Ignore("result will be delivered in tear down, after all checks are done")
public void testWhenNotMatchingExtraMatcher() {
Uri dummyContactDataUri = ContentUris.withAppendedId(ContactsContract.Data.CONTENT_URI, CONTACT_ID);
EspContactStub.register(dummyContactDataUri, Activity.RESULT_OK, IntentMatchers.hasExtraWithKey("MyKey"));
activity.startForResult(createContactPickerIntent(), REQUEST_CODE);
requestCodeTextView.assertTextIs("");
resultCodeTextView.assertTextIs("");
dataTextView.assertTextIs("");
}
开发者ID:nenick,项目名称:espresso-macchiato,代码行数:13,代码来源:EspContactStubTest.java
示例7: testRecipeAnalysis
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void testRecipeAnalysis() {
when(repository.getRecipeAnalysisData(ArgumentMatchers.<RecipeAnalysisParams>any()))
.thenReturn(Single.just(AssetUtils.getRecipeAnalysisResult(context)));
rule.launchActivity(new Intent());
selectTab();
inputFields();
onView(withId(R.id.btn_analyze)).perform(click());
Intents.intended(IntentMatchers.hasComponent(RecipeAnalysisDetailsActivity.class.getName()));
}
开发者ID:MLSDev,项目名称:RecipeFinderJavaVersion,代码行数:14,代码来源:RecipeAnalysisFragmentTest.java
示例8: checkShareWentOK
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Override
protected boolean checkShareWentOK() {
intended(allOf(
hasAction(Intent.ACTION_SEND),
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, mActivityRule.getActivity().getString(R.string.share_title))));
return true;
}
开发者ID:vincentbrison,项目名称:vb-android-app-quality,代码行数:8,代码来源:TestMainActivityWithEspresso.java
示例9: testThatDefaultBehaviorIsWorking
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Override
public void testThatDefaultBehaviorIsWorking() throws Exception {
Instrumentation.ActivityResult dummyResult = new Instrumentation.ActivityResult(0, null);
Intents.intending(allOf(
hasAction(Intent.ACTION_SEND),
IntentMatchers.hasExtra(Intent.EXTRA_SUBJECT, mActivityRule.getActivity().getString(R.string.share_title))))
.respondWith(dummyResult);
super.testThatDefaultBehaviorIsWorking();
}
开发者ID:vincentbrison,项目名称:vb-android-app-quality,代码行数:10,代码来源:TestMainActivityWithEspresso.java
示例10: showLoginActivity_if_not_signIn
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
@Test
public void showLoginActivity_if_not_signIn() {
Mockito.when(accountDaemon.hasAccount()).thenReturn(false);
activityRule.launchActivity(new Intent());
intended(IntentMatchers.hasComponent(LoginActivity.class.getName()));
}
开发者ID:kaif-open,项目名称:kaif-android,代码行数:7,代码来源:HomeActivityTest.java
示例11: shouldLoginWithSkip
import android.support.test.espresso.intent.matcher.IntentMatchers; //导入依赖的package包/类
public void shouldLoginWithSkip() {
onView(withId(R.id.emailEditText)).check(matches(isDisplayed()));
onView(withId(R.id.passwordEditText)).perform(typeText("[email protected]"));
onView(withId(R.id.signupButton)).perform(click());
Intents.intended(IntentMatchers.hasComponent(MainActivity.class.getName()));
}
开发者ID:RandoApp,项目名称:Rando-android,代码行数:7,代码来源:AuthActivityTest.java
注:本文中的android.support.test.espresso.intent.matcher.IntentMatchers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论