| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 private boolean waitForInterstitial(final boolean shouldBeShown) throws Inte
rruptedException { | 65 private boolean waitForInterstitial(final boolean shouldBeShown) throws Inte
rruptedException { |
| 66 return CriteriaHelper.pollForCriteria(new Criteria() { | 66 return CriteriaHelper.pollForCriteria(new Criteria() { |
| 67 @Override | 67 @Override |
| 68 public boolean isSatisfied() { | 68 public boolean isSatisfied() { |
| 69 try { | 69 try { |
| 70 return ThreadUtils.runOnUiThreadBlocking(new Callable<Boolea
n>() { | 70 return ThreadUtils.runOnUiThreadBlocking(new Callable<Boolea
n>() { |
| 71 @Override | 71 @Override |
| 72 public Boolean call() throws Exception { | 72 public Boolean call() throws Exception { |
| 73 return shouldBeShown | 73 return shouldBeShown |
| 74 == getContentViewCore().isShowingInterstitia
lPage(); | 74 == getWebContents().isShowingInterstitialPag
e(); |
| 75 } | 75 } |
| 76 }); | 76 }); |
| 77 } catch (ExecutionException e) { | 77 } catch (ExecutionException e) { |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 }); | 81 }); |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 @Override | 108 @Override |
| 109 protected void commandReceived(String command) { | 109 protected void commandReceived(String command) { |
| 110 assertEquals(command, proceedCommand); | 110 assertEquals(command, proceedCommand); |
| 111 proceed(); | 111 proceed(); |
| 112 } | 112 } |
| 113 }; | 113 }; |
| 114 TestWebContentsObserverAndroid observer = ThreadUtils.runOnUiThreadBlock
ing( | 114 TestWebContentsObserverAndroid observer = ThreadUtils.runOnUiThreadBlock
ing( |
| 115 new Callable<TestWebContentsObserverAndroid>() { | 115 new Callable<TestWebContentsObserverAndroid>() { |
| 116 @Override | 116 @Override |
| 117 public TestWebContentsObserverAndroid call() throws Exceptio
n { | 117 public TestWebContentsObserverAndroid call() throws Exceptio
n { |
| 118 getContentViewCore().showInterstitialPage(URL, delegate)
; | 118 getWebContents().showInterstitialPage(URL, delegate.getN
ative()); |
| 119 return new TestWebContentsObserverAndroid( | 119 return new TestWebContentsObserverAndroid(getWebContents
()); |
| 120 getContentViewCore().getWebContents()); | |
| 121 } | 120 } |
| 122 }); | 121 }); |
| 123 | 122 |
| 124 assertTrue("Interstitial never shown.", waitForInterstitial(true)); | 123 assertTrue("Interstitial never shown.", waitForInterstitial(true)); |
| 125 assertTrue("WebContentsObserver not notified of interstitial showing", | 124 assertTrue("WebContentsObserver not notified of interstitial showing", |
| 126 observer.isInterstitialShowing()); | 125 observer.isInterstitialShowing()); |
| 127 TouchCommon touchCommon = new TouchCommon(this); | 126 TouchCommon touchCommon = new TouchCommon(this); |
| 128 touchCommon.singleClickViewRelative(getContentViewCore().getContainerVie
w(), 10, 10); | 127 touchCommon.singleClickViewRelative(getContentViewCore().getContainerVie
w(), 10, 10); |
| 129 assertTrue("Interstitial never hidden.", waitForInterstitial(false)); | 128 assertTrue("Interstitial never hidden.", waitForInterstitial(false)); |
| 130 assertTrue("WebContentsObserver not notified of interstitial hiding", | 129 assertTrue("WebContentsObserver not notified of interstitial hiding", |
| 131 !observer.isInterstitialShowing()); | 130 !observer.isInterstitialShowing()); |
| 132 } | 131 } |
| 133 } | 132 } |
| OLD | NEW |