Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / public / test / android / javatests / src / org / chromium / content / browser / test / util / UiUtils.java
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content.browser.test.util;
6
7 import android.app.Instrumentation;
8
9 /**
10  * Collection of UI utilities.
11  */
12 public class UiUtils {
13
14     /**
15      * Waits for the UI thread to settle down and then waits for another second.
16      * <p>
17      * Avoid this method like the plague. It's a fantastically evil source of flakiness in tests.
18      * Instead, you should either:
19      *  - Use an observer interface if possible (preferred), or
20      *  - Use CriteriaHelper to poll for the desired condition becoming true
21      *
22      * @param instrumentation Instrumentation object used by the test.
23      */
24     public static void settleDownUI(Instrumentation instrumentation) throws InterruptedException {
25         instrumentation.waitForIdleSync();
26         Thread.sleep(1000);
27     }
28 }