当前位置: 首页>>代码示例>>Java>>正文


Java IdlingPolicies类代码示例

本文整理汇总了Java中android.support.test.espresso.IdlingPolicies的典型用法代码示例。如果您正苦于以下问题:Java IdlingPolicies类的具体用法?Java IdlingPolicies怎么用?Java IdlingPolicies使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IdlingPolicies类属于android.support.test.espresso包,在下文中一共展示了IdlingPolicies类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:EthanCo,项目名称:AndroidTesting,代码行数:25,代码来源:TimingActivityTest.java

示例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);
}
 
开发者ID:chiuki,项目名称:espresso-samples,代码行数:25,代码来源:MainActivityTest.java

示例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);
}
 
开发者ID:kevalpatel2106,项目名称:smart-lens,代码行数:14,代码来源:Delay.java

示例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);
}
 
开发者ID:hernandazevedo,项目名称:starwarsshop,代码行数:15,代码来源:StarWarsStoreBehaviorTests.java

示例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;
    }
 
开发者ID:hernandazevedo,项目名称:starwarsshop,代码行数:13,代码来源:ElapsedTimeIdlingResource.java

示例6: testLoopback

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
@Test
public void testLoopback() throws InterruptedException {
  // The time to write down the data during closing of the program can take a while.
  IdlingPolicies.setMasterPolicyTimeout(240000, TimeUnit.MILLISECONDS);

  // During the time we sleep it will record video.
  Thread.sleep(10000);

  // Click on hang-up button.
  onView(withId(R.id.button_call_disconnect)).perform(click());
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:12,代码来源:ConnectActivityStubbedInputOutputTest.java

示例7: onStartTest

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
@OnStartTest()
public void onStartTest(String featureName, String scenarioName) {

    IdlingPolicies.setMasterPolicyTimeout(30, TimeUnit.SECONDS);

    Log.v(runnerConfig.LogTag, "Starting Test: " + featureName + " - " + scenarioName);
    Intents.init();
}
 
开发者ID:andrewjc,项目名称:kheera-testrunner-android,代码行数:9,代码来源:LoginPageFeatureFile.java

示例8: 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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:11,代码来源:TestUtils.java

示例9: 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();
    }
}
 
开发者ID:dasfoo,项目名称:delern,代码行数:10,代码来源:FirebaseOperationInProgressRule.java

示例10: BaseIdlingResource

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
public BaseIdlingResource() {
    IdlingPolicies.setIdlingResourceTimeout(DEFAULT_IDLING_TIMEOUT, TimeUnit.MILLISECONDS);
}
 
开发者ID:PGSSoft,项目名称:espresso-doppio,代码行数:4,代码来源:BaseIdlingResource.java

示例11: resetTimeout

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
@Before
public void resetTimeout() {
    IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
    IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS);
}
 
开发者ID:EthanCo,项目名称:AndroidTesting,代码行数:6,代码来源:TimingActivityTest.java

示例12: detectIfNoToken

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
public void detectIfNoToken() {
    IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
    IdlingPolicies.setIdlingResourceTimeout(60, TimeUnit.SECONDS);
    checkToken();

}
 
开发者ID:bluesnap,项目名称:bluesnap-android-int,代码行数:7,代码来源:EspressoBasedTest.java

示例13: setTestTimeoutSeconds

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
public static void setTestTimeoutSeconds(int seconds) {
    IdlingPolicies.setMasterPolicyTimeout(
            seconds, TimeUnit.SECONDS);
    IdlingPolicies.setIdlingResourceTimeout(
            seconds, TimeUnit.SECONDS);
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:7,代码来源:SDKTestUtils.java

示例14: 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);
}
 
开发者ID:seguemodev,项目名称:Meducated-Ninja,代码行数:7,代码来源:SplashActivityTest.java

示例15: resetTimeout

import android.support.test.espresso.IdlingPolicies; //导入依赖的package包/类
@Before
public void resetTimeout() {
  IdlingPolicies.setMasterPolicyTimeout(60, TimeUnit.SECONDS);
  IdlingPolicies.setIdlingResourceTimeout(26, TimeUnit.SECONDS);
}
 
开发者ID:chiuki,项目名称:espresso-samples,代码行数:6,代码来源:MainActivityTest.java


注:本文中的android.support.test.espresso.IdlingPolicies类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。