本文整理汇总了Java中android.support.test.espresso.IdlingRegistry类的典型用法代码示例。如果您正苦于以下问题:Java IdlingRegistry类的具体用法?Java IdlingRegistry怎么用?Java IdlingRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdlingRegistry类属于android.support.test.espresso包,在下文中一共展示了IdlingRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitFor
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
private static void waitFor(long waitingTime, boolean success) {
// Start
onView(withId(R.id.toggle_button))
.check(matches(withText(R.string.start)))
.perform(click());
// Make sure Espresso does not time out
IdlingPolicies.setMasterPolicyTimeout(waitingTime * 2, TimeUnit.MILLISECONDS);
IdlingPolicies.setIdlingResourceTimeout(waitingTime * 2, TimeUnit.MILLISECONDS);
// Now we wait
IdlingResource idlingResource = new ElapsedTimeIdlingResource(waitingTime);
IdlingRegistry.getInstance().register(idlingResource);
// Stop and verify
onView(withId(R.id.toggle_button))
.check(matches(withText(R.string.stop)))
.perform(click());
onView(withId(R.id.result))
.check(matches(withText(success ? R.string.success: R.string.failure)));
// Clean up
IdlingRegistry.getInstance().unregister(idlingResource);
}
示例2: setupRxScheduler
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
private static void setupRxScheduler() {
CountingIdlingResource idlingResource = new CountingIdlingResource("rxJava");
IdlingRegistry.getInstance().register(idlingResource);
RxJavaTestScheduler.init(s -> Schedulers.from(runnable -> {
idlingResource.increment();
new Thread(() -> {
runnable.run();
idlingResource.decrement();
}).start();
}));
}
示例3: testFabButtonAndList
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Test
public void testFabButtonAndList() {
IdlingResource ir = new RecyclerViewScrollingIdlingResource((RecyclerView) activity.findViewById(R.id.list));
IdlingRegistry.getInstance().register(ir);
Matcher listMatcher = withId(R.id.list);
onView(listMatcher).perform(smoothScrollTo(12));
onView(withId(R.id.fab)).perform(click());
onView(listMatcher).perform(smoothScrollTo(0));
onView(withId(R.id.fab)).perform(click());
IdlingRegistry.getInstance().unregister(ir);
}
示例4: setUp
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Intents.init();
mIdlingResource = mActivityRule.getActivity().getIdlingResource();
IdlingRegistry.getInstance().register(mIdlingResource);
}
示例5: tearDown
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDown() {
Intents.release();
if (mIdlingResource != null) {
IdlingRegistry.getInstance().unregister(mIdlingResource);
}
}
示例6: name
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Test
public void name() {
IdlingResource idlingResource = OkHttp3IdlingResource.create(
"okhttp", OkHttpProvider.getOkHttpInstance());
IdlingRegistry.getInstance().register(idlingResource);
onView(withId(R.id.name))
.check(matches(withText("Chiu-Ki Chan")));
IdlingRegistry.getInstance().unregister(idlingResource);
}
示例7: unregisterIdlingResource
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
* Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
*/
@After
public void unregisterIdlingResource() {
IdlingRegistry.getInstance().unregister(
mAddTaskIntentsTestRule.getActivity().getCountingIdlingResource());
}
示例8: tearDown
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
/**
* Unregister your Idling Resource so it can be garbage collected and does not leak any memory.
*/
@After
public void tearDown() throws Exception {
IdlingRegistry.getInstance().unregister(
mTasksActivityTestRule.getActivity().getCountingIdlingResource());
}
示例9: registerOkHttp
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
public static void registerOkHttp(OkHttpClient client) {
IdlingRegistry.getInstance().register(OkHttp3IdlingResource.create("okhttp", client));
}
示例10: registerIdlingResource
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void registerIdlingResource() {
IdlingRegistry.getInstance().register(EspressoIdlingResource.getIdlingResource());
}
示例11: unregisterIdlingResource
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void unregisterIdlingResource() {
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.getIdlingResource());
}
示例12: setUp
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUp() {
loadingIdlingResource = new SessionLoadedIdlingResource();
IdlingRegistry.getInstance().register(loadingIdlingResource);
}
示例13: tearDown
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
IdlingRegistry.getInstance().unregister(loadingIdlingResource);
mActivityTestRule.getActivity().finishAndRemoveTask();
}
示例14: setUpIdlingResources
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@Before
public void setUpIdlingResources() {
loadingIdlingResource = new SessionLoadedIdlingResource();
IdlingRegistry.getInstance().register(loadingIdlingResource);
}
示例15: tearDownIdlingResources
import android.support.test.espresso.IdlingRegistry; //导入依赖的package包/类
@After
public void tearDownIdlingResources() {
IdlingRegistry.getInstance().unregister(loadingIdlingResource);
}