當前位置: 首頁>>代碼示例>>Java>>正文


Java IdlingResource.ResourceCallback方法代碼示例

本文整理匯總了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);
}
 
開發者ID:JakeWharton,項目名稱:okhttp-idling-resource,代碼行數:21,代碼來源:OkHttp3IdlingResourceTest.java

示例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;
}
 
開發者ID:DimaKoz,項目名稱:meat-grinder,代碼行數:6,代碼來源:MainActivityTest.java

示例4: registerIdleTransitionCallback

import android.support.test.espresso.IdlingResource; //導入方法依賴的package包/類
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback resourceCallback) {
  this.resourceCallback = resourceCallback;
}
 
開發者ID:eurosecom,項目名稱:Attendance,代碼行數:5,代碼來源:DgAeaActivityTest.java

示例5: registerIdleTransitionCallback

import android.support.test.espresso.IdlingResource; //導入方法依賴的package包/類
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback resourceCallback) {
	this.resourceCallback = resourceCallback;
}
 
開發者ID:TakuSemba,項目名稱:EspressoDemo,代碼行數:5,代碼來源:ElapsedTimeIdlingResource.java

示例6: registerIdleTransitionCallback

import android.support.test.espresso.IdlingResource; //導入方法依賴的package包/類
@Override
public void registerIdleTransitionCallback(IdlingResource.ResourceCallback callback) {
  resourceCallback = callback;
}
 
開發者ID:material-components,項目名稱:material-components-android,代碼行數:5,代碼來源:BottomSheetBehaviorTest.java


注:本文中的android.support.test.espresso.IdlingResource.ResourceCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。