本文整理汇总了Java中android.support.test.espresso.IdlingPolicies.setIdlingResourceTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java IdlingPolicies.setIdlingResourceTimeout方法的具体用法?Java IdlingPolicies.setIdlingResourceTimeout怎么用?Java IdlingPolicies.setIdlingResourceTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.espresso.IdlingPolicies
的用法示例。
在下文中一共展示了IdlingPolicies.setIdlingResourceTimeout方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitFor
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
private static void waitFor(long waitingTime, boolean success) {
//Start
onView(withId(R.id.toggle_button))
.check(matches(withText(R.string.start)))
.perform(click());
//Mack 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);
Espresso.registerIdlingResources(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
Espresso.unregisterIdlingResources(idlingResource);
}
示例2: waitFor
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的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);
}
示例3: startDelay
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
/**
* Register idling resource to delay for given time.
*
* @param waitTimeMills Wait time in millisecond.
*/
public static void startDelay(long waitTimeMills) {
// Make sure Espresso does not time out
IdlingPolicies.setMasterPolicyTimeout(waitTimeMills * 2, TimeUnit.MILLISECONDS);
IdlingPolicies.setIdlingResourceTimeout(waitTimeMills * 2, TimeUnit.MILLISECONDS);
sTimeIdlingResource = new Delay(waitTimeMills);
Espresso.registerIdlingResources(sTimeIdlingResource);
}
示例4: registerIntentServiceIdlingResource
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@Before
public void registerIntentServiceIdlingResource() {
unlockScreen();
// Make sure Espresso does not time out
IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(30, TimeUnit.SECONDS);
//Wait the activity to start completely
MainActivity activity = mActivityRule.getActivity();
idlingResource = new MainActivityIdlingResource(activity);
Espresso.registerIdlingResources(idlingResource);
}
示例5: waitFor
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
public static IdlingResource waitFor(long waitingTime) {
// 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);
Espresso.registerIdlingResources(idlingResource);
return idlingResource;
}
示例6: waitForDialog
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@NonNull
public static IdlingResource waitForDialog(@NonNull FragmentManager fragmentManager, @NonNull String tag) {
IdlingPolicies.setMasterPolicyTimeout(3, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(3, TimeUnit.SECONDS);
IdlingResource idlingResource = new DialogFragmentIdlingResource(fragmentManager, tag);
Espresso.registerIdlingResources(idlingResource);
return idlingResource;
}
示例7: before
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@Override
protected void before() throws Throwable {
// Raise Idling policy timeout because emulator or network can be really slow.
IdlingPolicies.setIdlingResourceTimeout(2, TimeUnit.MINUTES);
IdlingPolicies.setMasterPolicyTimeout(2, TimeUnit.MINUTES);
if (mDefaultEnabled) {
enableForCurrentTestCase();
}
}
示例8: BaseIdlingResource
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
public BaseIdlingResource() {
IdlingPolicies.setIdlingResourceTimeout(DEFAULT_IDLING_TIMEOUT, TimeUnit.MILLISECONDS);
}
示例9: resetTimeout
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@Before
public void resetTimeout() {
IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS);
}
示例10: detectIfNoToken
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
public void detectIfNoToken() {
IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(60, TimeUnit.SECONDS);
checkToken();
}
示例11: setTestTimeoutSeconds
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
public static void setTestTimeoutSeconds(int seconds) {
IdlingPolicies.setMasterPolicyTimeout(
seconds, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(
seconds, TimeUnit.SECONDS);
}
示例12: setUp
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@Before
public void setUp() {
// ensure that espresso doesn't time out while we're intentionally idling.
IdlingPolicies.setMasterPolicyTimeout(SplashActivity.DISPLAY_TIME * 2, TimeUnit.MILLISECONDS);
IdlingPolicies.setIdlingResourceTimeout(SplashActivity.DISPLAY_TIME * 2, TimeUnit.MILLISECONDS);
}
示例13: resetTimeout
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@Before
public void resetTimeout() {
IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS);
}
示例14: beforeClass
import android.support.test.espresso.IdlingPolicies; //导入方法依赖的package包/类
@BeforeClass
public static void beforeClass() {
IdlingPolicies.setMasterPolicyTimeout(600, TimeUnit.SECONDS);
IdlingPolicies.setIdlingResourceTimeout(600, TimeUnit.SECONDS);
}