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.net.Uri; | 7 import android.net.Uri; |
8 | 8 |
9 import static org.chromium.base.test.util.ScalableTimeout.ScaleTimeout; | 9 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
10 | 10 |
11 import org.chromium.base.test.util.UrlUtils; | 11 import org.chromium.base.test.util.UrlUtils; |
12 import org.chromium.content.browser.test.util.DOMUtils; | 12 import org.chromium.content.browser.test.util.DOMUtils; |
13 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 13 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
14 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; | 14 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; |
15 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnStar
tContentIntentHelper; | 15 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnStar
tContentIntentHelper; |
16 import org.chromium.content_shell_apk.ContentShellTestBase; | 16 import org.chromium.content_shell_apk.ContentShellTestBase; |
17 | 17 |
18 import java.util.concurrent.TimeUnit; | 18 import java.util.concurrent.TimeUnit; |
19 | 19 |
20 /** | 20 /** |
21 * Base class for content detection test suites. | 21 * Base class for content detection test suites. |
22 */ | 22 */ |
23 public class ContentDetectionTestBase extends ContentShellTestBase { | 23 public class ContentDetectionTestBase extends ContentShellTestBase { |
24 | 24 |
25 private static final long WAIT_TIMEOUT_SECONDS = ScaleTimeout(10); | 25 private static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(10); |
26 | 26 |
27 private TestCallbackHelperContainer mCallbackHelper; | 27 private TestCallbackHelperContainer mCallbackHelper; |
28 | 28 |
29 /** | 29 /** |
30 * Returns the TestCallbackHelperContainer associated with this ContentView, | 30 * Returns the TestCallbackHelperContainer associated with this ContentView, |
31 * or creates it lazily. | 31 * or creates it lazily. |
32 */ | 32 */ |
33 protected TestCallbackHelperContainer getTestCallbackHelperContainer() { | 33 protected TestCallbackHelperContainer getTestCallbackHelperContainer() { |
34 if (mCallbackHelper == null) { | 34 if (mCallbackHelper == null) { |
35 mCallbackHelper = new TestCallbackHelperContainer(getContentView()); | 35 mCallbackHelper = new TestCallbackHelperContainer(getContentView()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 int currentCallCount = onPageFinishedHelper.getCallCount(); | 88 int currentCallCount = onPageFinishedHelper.getCallCount(); |
89 | 89 |
90 DOMUtils.scrollNodeIntoView(getContentView(), callbackHelperContainer, i
d); | 90 DOMUtils.scrollNodeIntoView(getContentView(), callbackHelperContainer, i
d); |
91 DOMUtils.clickNode(this, getContentView(), callbackHelperContainer, id); | 91 DOMUtils.clickNode(this, getContentView(), callbackHelperContainer, id); |
92 | 92 |
93 onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_S
ECONDS, | 93 onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_S
ECONDS, |
94 TimeUnit.SECONDS); | 94 TimeUnit.SECONDS); |
95 getInstrumentation().waitForIdleSync(); | 95 getInstrumentation().waitForIdleSync(); |
96 } | 96 } |
97 } | 97 } |
OLD | NEW |