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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/InterstitialPageTest.java

Issue 2573263002: Catch InterruptedException in CriteriaHelper (Closed)
Patch Set: Change OverviewModeBehaviorWatcher back to try/finally Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.test.suitebuilder.annotation.LargeTest; 7 import android.test.suitebuilder.annotation.LargeTest;
8 8
9 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
10 import org.chromium.base.test.util.Feature; 10 import org.chromium.base.test.util.Feature;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 @Override 59 @Override
60 protected void setUp() throws Exception { 60 protected void setUp() throws Exception {
61 super.setUp(); 61 super.setUp();
62 ContentShellActivity activity = launchContentShellWithUrl(URL); 62 ContentShellActivity activity = launchContentShellWithUrl(URL);
63 assertNotNull(activity); 63 assertNotNull(activity);
64 waitForActiveShellToBeDoneLoading(); 64 waitForActiveShellToBeDoneLoading();
65 } 65 }
66 66
67 private void waitForInterstitial(final boolean shouldBeShown) throws Interru ptedException { 67 private void waitForInterstitial(final boolean shouldBeShown) {
68 CriteriaHelper.pollUiThread( 68 CriteriaHelper.pollUiThread(
69 Criteria.equals(shouldBeShown, new Callable<Boolean>() { 69 Criteria.equals(shouldBeShown, new Callable<Boolean>() {
70 @Override 70 @Override
71 public Boolean call() { 71 public Boolean call() {
72 return getWebContents().isShowingInterstitialPage(); 72 return getWebContents().isShowingInterstitialPage();
73 } 73 }
74 })); 74 }));
75 } 75 }
76 76
77 /** 77 /**
78 * Tests that showing and hiding an interstitial works. 78 * Tests that showing and hiding an interstitial works.
79 */ 79 */
80 @LargeTest 80 @LargeTest
81 @Feature({"Navigation"}) 81 @Feature({"Navigation"})
82 @RetryOnFailure 82 @RetryOnFailure
83 public void testCloseInterstitial() throws InterruptedException, ExecutionEx ception { 83 public void testCloseInterstitial() throws ExecutionException {
84 final String proceedCommand = "PROCEED"; 84 final String proceedCommand = "PROCEED";
85 final String htmlContent = "<html>" 85 final String htmlContent = "<html>"
86 + "<head>" 86 + "<head>"
87 + " <script>" 87 + " <script>"
88 + " function sendCommand(command) {" 88 + " function sendCommand(command) {"
89 + " window.domAutomationController.setAutomationId(1);" 89 + " window.domAutomationController.setAutomationId(1);"
90 + " window.domAutomationController.send(command);" 90 + " window.domAutomationController.send(command);"
91 + " }" 91 + " }"
92 + " </script>" 92 + " </script>"
93 + "</head>" 93 + "</head>"
(...skipping 21 matching lines...) Expand all
115 115
116 waitForInterstitial(true); 116 waitForInterstitial(true);
117 assertTrue("WebContentsObserver not notified of interstitial showing", 117 assertTrue("WebContentsObserver not notified of interstitial showing",
118 observer.isInterstitialShowing()); 118 observer.isInterstitialShowing());
119 TouchCommon.singleClickView(getContentViewCore().getContainerView(), 10, 10); 119 TouchCommon.singleClickView(getContentViewCore().getContainerView(), 10, 10);
120 waitForInterstitial(false); 120 waitForInterstitial(false);
121 assertTrue("WebContentsObserver not notified of interstitial hiding", 121 assertTrue("WebContentsObserver not notified of interstitial hiding",
122 !observer.isInterstitialShowing()); 122 !observer.isInterstitialShowing());
123 } 123 }
124 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698