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

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

Issue 141533006: [Android] Move the java content/ package to content_public/ to start the split. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small fixes and findbugs line update Created 6 years, 11 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
Index: content/public/test/android/javatests/src/org/chromium/content/browser/test/util/UiUtils.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/UiUtils.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/UiUtils.java
deleted file mode 100644
index 7d583c43c4b3546900034af909c7b66f166420dd..0000000000000000000000000000000000000000
--- a/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/UiUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser.test.util;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-
-import junit.framework.Assert;
-
-import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout;
-
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Collection of UI utilities.
- */
-public class UiUtils {
- // timeout to wait for runOnUiThread()
- private static final long WAIT_FOR_RESPONSE_MS = ScaleTimeout(10000);
-
- /**
- * Runs the runnable on the UI thread.
- *
- * @param activity The activity on which the runnable must run.
- * @param runnable The runnable to run.
- */
- public static void runOnUiThread(Activity activity, final Runnable runnable) {
- final Semaphore finishedSemaphore = new Semaphore(0);
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- runnable.run();
- finishedSemaphore.release();
- }
- });
- try {
- Assert.assertTrue(finishedSemaphore.tryAcquire(1, WAIT_FOR_RESPONSE_MS,
- TimeUnit.MILLISECONDS));
- } catch (InterruptedException ignored) {
- Assert.assertTrue("Interrupted while waiting for main thread Runnable", false);
- }
- }
-
- /**
- * Waits for the UI thread to settle down.
- * <p>
- * Waits for an extra period of time after the UI loop is idle.
- *
- * @param instrumentation Instrumentation object used by the test.
- */
- public static void settleDownUI(Instrumentation instrumentation) throws InterruptedException {
- instrumentation.waitForIdleSync();
- Thread.sleep(1000);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698