本文整理匯總了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;
}