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


Java UiController.loopMainThreadForAtLeast方法代碼示例

本文整理匯總了Java中android.support.test.espresso.UiController.loopMainThreadForAtLeast方法的典型用法代碼示例。如果您正苦於以下問題:Java UiController.loopMainThreadForAtLeast方法的具體用法?Java UiController.loopMainThreadForAtLeast怎麽用?Java UiController.loopMainThreadForAtLeast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.test.espresso.UiController的用法示例。


在下文中一共展示了UiController.loopMainThreadForAtLeast方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: closeSoftKeyboard

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
public static ViewAction closeSoftKeyboard() {
	return new ViewAction() {
		/**
		 * The real {@link CloseKeyboardAction} instance.
		 */
		private final ViewAction mCloseSoftKeyboard = new CloseKeyboardAction();

		@Override
		public Matcher<View> getConstraints() {
			return mCloseSoftKeyboard.getConstraints();
		}

		@Override
		public String getDescription() {
			return mCloseSoftKeyboard.getDescription();
		}

		@Override
		public void perform(final UiController uiController, final View view) {
			mCloseSoftKeyboard.perform(uiController, view);
			uiController.loopMainThreadForAtLeast(KEYBOARD_DISMISSAL_DELAY_MILLIS);
		}
	};
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:StartupTest.java

示例2: loopMainThreadFor

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
public static ViewAction loopMainThreadFor(final long millis) {
	return new ViewAction() {

		@Override
		public Matcher<View> getConstraints() {
			return isEnabled();
		}

		@Override
		public String getDescription() {
			return "Rturns an action that loops the main thread for at least " + millis +"ms.";
		}

		@Override
		public void perform(final UiController uiController, final View view) {
			uiController.loopMainThreadForAtLeast(millis);
		}
	};
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:StartupTest.java

示例3: waitFor

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
public static ViewAction waitFor(final long millis) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {
            return "Wait for " + millis + " milliseconds.";
        }

        @Override
        public void perform(UiController uiController, final View view) {
            uiController.loopMainThreadForAtLeast(millis);
        }
    };
}
 
開發者ID:d4rken,項目名稱:ommvplib,代碼行數:19,代碼來源:TestHelper.java

示例4: performWaitLoop

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
public static void performWaitLoop(UiController controller, long waitTime) {
  controller.loopMainThreadForAtLeast(waitTime);
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:4,代碼來源:WaitLoopAction.java

示例5: closeSoftKeyboardWithDelay

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
/**
 * Give keyboard time to close, to avoid java.lang.SecurityException
 * if hidden button is clicked next.
 */
static ViewAction closeSoftKeyboardWithDelay() {
    return new ViewAction() {
        /**
         * The delay time to allow the soft keyboard to dismiss.
         */
        private static final long KEYBOARD_DISMISSAL_DELAY_MILLIS = 1000L;

        /**
         * The real {@link CloseKeyboardAction} instance.
         */
        private final ViewAction mCloseSoftKeyboard = new CloseKeyboardAction();

        @Override
        public Matcher<View> getConstraints() {
            return mCloseSoftKeyboard.getConstraints();
        }

        @Override
        public String getDescription() {
            return mCloseSoftKeyboard.getDescription();
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            mCloseSoftKeyboard.perform(uiController, view);
            uiController.loopMainThreadForAtLeast(KEYBOARD_DISMISSAL_DELAY_MILLIS);
        }
    };
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:34,代碼來源:EspressoUtils.java

示例6: waitForMatch

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
public static ViewAction waitForMatch(final Matcher<View> aViewMatcher, final long timeout) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {
            return "Waiting for view matching " + aViewMatcher;
        }

        @Override
        public void perform(UiController uiController, View view) {
            uiController.loopMainThreadUntilIdle();

            final long startTime = System.currentTimeMillis();
            final long endTime = startTime + timeout;

            do {
                for (View child : TreeIterables.breadthFirstViewTraversal(view)) {
                    if (aViewMatcher.matches(child)) {
                        // found
                        return;
                    }
                }


                uiController.loopMainThreadForAtLeast(50);
            } while (System.currentTimeMillis() < endTime);

            //The action has timed out.
            throw new PerformException.Builder()
                    .withActionDescription(getDescription())
                    .withViewDescription("")
                    .withCause(new TimeoutException())
                    .build();
        }
    };
}
 
開發者ID:IrrilevantHappyLlamas,項目名稱:Runnest,代碼行數:41,代碼來源:EspressoTest.java

示例7: waitId

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
/**
 * Perform action of waiting for a specific view id.
 */
public static ViewAction waitId(final int viewId, final long millis) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {
            return "wait for a specific view with id <" + viewId + "> during " + millis + " millis.";
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            uiController.loopMainThreadUntilIdle();
            final long startTime = System.currentTimeMillis();
            final long endTime = startTime + millis;
            final Matcher<View> viewMatcher = withId(viewId);

            do {
                for (View child : TreeIterables.breadthFirstViewTraversal(view)) {
                    // found view with required ID
                    if (viewMatcher.matches(child)) {
                        return;
                    }
                }

                uiController.loopMainThreadForAtLeast(50);
            }
            while (System.currentTimeMillis() < endTime);

            // timeout happens
            throw new PerformException.Builder()
                    .withActionDescription(this.getDescription())
                    .withViewDescription(HumanReadables.describe(view))
                    .withCause(new TimeoutException())
                    .build();
        }
    };
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:44,代碼來源:Utils.java

示例8: perform

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
@Override
public void perform(UiController uiController, View view) {
  uiController.loopMainThreadForAtLeast(loopTime);
}
 
開發者ID:mapbox,項目名稱:mapbox-navigation-android,代碼行數:5,代碼來源:WaitLoopAction.java

示例9: waitId

import android.support.test.espresso.UiController; //導入方法依賴的package包/類
/** Perform action of waiting for a specific view id. */
public static ViewAction waitId(final int viewId, final long millis) {
    return new ViewAction() {
        @Override
        public Matcher<View> getConstraints() {
            return isRoot();
        }

        @Override
        public String getDescription() {
            return "wait for a specific view with id <" + viewId + "> during " + millis + " millis.";
        }

        @Override
        public void perform(final UiController uiController, final View view) {
            uiController.loopMainThreadUntilIdle();
            final long startTime = System.currentTimeMillis();
            final long endTime = startTime + millis;
            final Matcher<View> viewMatcher = withId(viewId);

            do {
                for (View child : TreeIterables.breadthFirstViewTraversal(view)) {
                    // found view with required ID
                    if (viewMatcher.matches(child)) {
                        return;
                    }
                }

                uiController.loopMainThreadForAtLeast(50);
            }
            while (System.currentTimeMillis() < endTime);

            // timeout happens
            throw new PerformException.Builder()
                    .withActionDescription(this.getDescription())
                    .withViewDescription(HumanReadables.describe(view))
                    .withCause(new TimeoutException())
                    .build();
        }
    };
}
 
開發者ID:CMPUT301F17T13,項目名稱:cat-is-a-dog,代碼行數:42,代碼來源:ViewActions.java


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