本文整理汇总了Java中android.support.test.espresso.IdlingResource.ResourceCallback方法的典型用法代码示例。如果您正苦于以下问题:Java IdlingResource.ResourceCallback方法的具体用法?Java IdlingResource.ResourceCallback怎么用?Java IdlingResource.ResourceCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.espresso.IdlingResource
的用法示例。
在下文中一共展示了IdlingResource.ResourceCallback方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: idleCallback
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Test public void idleCallback() throws InterruptedException, IOException {
server.enqueue(new MockResponse());
OkHttpClient client = new OkHttpClient();
IdlingResource idlingResource = OkHttp3IdlingResource.create("Ok!", client);
final AtomicInteger count = new AtomicInteger();
IdlingResource.ResourceCallback callback = new IdlingResource.ResourceCallback() {
@Override public void onTransitionToIdle() {
count.getAndIncrement();
}
};
idlingResource.registerIdleTransitionCallback(callback);
assertThat(count.get()).isEqualTo(0);
// Use a synchronous call as a quick way to transition from busy to idle in a blocking way.
client.newCall(new Request.Builder().url(server.url("/")).build()).execute().close();
assertThat(count.get()).isEqualTo(1);
}
示例2: onIdle
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Override
protected void onIdle() {
super.onIdle();
for (IdlingResource.ResourceCallback callback : callbacks) {
callback.onTransitionToIdle();
}
}
开发者ID:googlesamples,项目名称:android-architecture-components,代码行数:8,代码来源:TaskExecutorWithIdlingResourceRule.java
示例3: registerIdleTransitionCallback
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Override
public void registerIdleTransitionCallback(
IdlingResource.ResourceCallback resourceCallback) {
this.resourceCallback = resourceCallback;
}
示例4: registerIdleTransitionCallback
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback resourceCallback) {
this.resourceCallback = resourceCallback;
}
示例5: registerIdleTransitionCallback
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback resourceCallback) {
this.resourceCallback = resourceCallback;
}
示例6: registerIdleTransitionCallback
import android.support.test.espresso.IdlingResource; //导入方法依赖的package包/类
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback callback) {
resourceCallback = callback;
}