| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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.chrome.browser.widget; | |
| 6 | |
| 7 import android.test.suitebuilder.annotation.MediumTest; | |
| 8 | |
| 9 import org.chromium.base.ThreadUtils; | |
| 10 import org.chromium.base.test.util.Feature; | |
| 11 import org.chromium.chrome.shell.ChromeShellTestBase; | |
| 12 import org.chromium.chrome.shell.R; | |
| 13 import org.chromium.content.browser.test.util.Criteria; | |
| 14 import org.chromium.content.browser.test.util.CriteriaHelper; | |
| 15 | |
| 16 import java.util.concurrent.atomic.AtomicReference; | |
| 17 | |
| 18 /** | |
| 19 * Tests related to the ToolbarProgressBar. | |
| 20 */ | |
| 21 public class ClipDrawableProgressBarTest extends ChromeShellTestBase { | |
| 22 /** | |
| 23 * Test that calling progressBar.setProgress(# > 0) followed by progressBar.
setProgress(0) | |
| 24 * results in a hidden progress bar (the secondary progress needs to be 0). | |
| 25 * @throws InterruptedException | |
| 26 */ | |
| 27 @Feature({"Android-Toolbar"}) | |
| 28 @MediumTest | |
| 29 public void testProgressBarDisappearsAfterFastShowHide() throws InterruptedE
xception { | |
| 30 launchChromeShellWithUrl("about:blank"); | |
| 31 waitForActiveShellToBeDoneLoading(); | |
| 32 | |
| 33 final AtomicReference<ClipDrawableProgressBar> progressBar = | |
| 34 new AtomicReference<ClipDrawableProgressBar>(); | |
| 35 ThreadUtils.runOnUiThread(new Runnable() { | |
| 36 @Override | |
| 37 public void run() { | |
| 38 progressBar.set( | |
| 39 (ClipDrawableProgressBar) getActivity().findViewById(R.i
d.progress)); | |
| 40 } | |
| 41 }); | |
| 42 | |
| 43 // Make sure that there is some progress. | |
| 44 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | |
| 45 @Override | |
| 46 public boolean isSatisfied() { | |
| 47 return progressBar.get().getProgress() > 0; | |
| 48 } | |
| 49 }); | |
| 50 | |
| 51 // Wait for the progress bar to be reset. | |
| 52 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { | |
| 53 @Override | |
| 54 public boolean isSatisfied() { | |
| 55 return progressBar.get().getProgress() == 0; | |
| 56 } | |
| 57 }); | |
| 58 } | |
| 59 } | |
| OLD | NEW |