Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1609)

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java

Issue 2434473002: refactor waitUntilCriteria out of CallbackHelper (Closed)
Patch Set: nit Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java
index c1e91ec8a2a2eb41d4d8e849cfd6a05e574b1900..f5e13b7d7a31f5261c88b6e98a61bd52586f3e84 100644
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/CallbackHelper.java
@@ -6,8 +6,6 @@ package org.chromium.content.browser.test.util;
import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
-import android.os.SystemClock;
-
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -199,32 +197,6 @@ public class CallbackHelper {
}
/**
- * Blocks until the criteria is satisfied or throws an exception
- * if the specified time frame is exceeded.
- * @param timeout timeout value.
- * @param unit timeout unit.
- */
- public void waitUntilCriteria(Criteria criteria, long timeout, TimeUnit unit)
- throws InterruptedException, TimeoutException {
- synchronized (mLock) {
- final long startTime = SystemClock.uptimeMillis();
- boolean isSatisfied = criteria.isSatisfied();
- while (!isSatisfied
- && SystemClock.uptimeMillis() - startTime < unit.toMillis(timeout)) {
- mLock.wait(unit.toMillis(timeout));
- isSatisfied = criteria.isSatisfied();
- }
-
- if (!isSatisfied) throw new TimeoutException(criteria.getFailureReason());
- }
- }
-
- public void waitUntilCriteria(Criteria criteria)
- throws InterruptedException, TimeoutException {
- waitUntilCriteria(criteria, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
- }
-
- /**
* Should be called when the callback associated with this helper object is called.
*/
public void notifyCalled() {
« no previous file with comments | « no previous file | content/public/test/android/javatests/src/org/chromium/content/browser/test/util/TestCallbackHelperContainer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698