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 static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
8 | 8 |
9 import android.net.Uri; | 9 import android.net.Uri; |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * Scrolls to the node with the provided id, taps on it and waits for an int
ent to come. | 60 * Scrolls to the node with the provided id, taps on it and waits for an int
ent to come. |
61 * @param id Id of the node to scroll and tap. | 61 * @param id Id of the node to scroll and tap. |
62 * @return The content url of the received intent or null if none. | 62 * @return The content url of the received intent or null if none. |
63 */ | 63 */ |
64 protected String scrollAndTapExpectingIntent(String id) throws Throwable { | 64 protected String scrollAndTapExpectingIntent(String id) throws Throwable { |
65 TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHel
perContainer(); | 65 TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHel
perContainer(); |
66 OnStartContentIntentHelper onStartContentIntentHelper = | 66 OnStartContentIntentHelper onStartContentIntentHelper = |
67 callbackHelperContainer.getOnStartContentIntentHelper(); | 67 callbackHelperContainer.getOnStartContentIntentHelper(); |
68 int currentCallCount = onStartContentIntentHelper.getCallCount(); | 68 int currentCallCount = onStartContentIntentHelper.getCallCount(); |
69 | 69 |
70 DOMUtils.scrollNodeIntoView(getContentViewCore(), id); | 70 DOMUtils.scrollNodeIntoView(getWebContents(), id); |
71 DOMUtils.clickNode(this, getContentViewCore(), id); | 71 DOMUtils.clickNode(this, getContentViewCore(), id); |
72 | 72 |
73 onStartContentIntentHelper.waitForCallback(currentCallCount, 1, WAIT_TIM
EOUT_SECONDS, | 73 onStartContentIntentHelper.waitForCallback(currentCallCount, 1, WAIT_TIM
EOUT_SECONDS, |
74 TimeUnit.SECONDS); | 74 TimeUnit.SECONDS); |
75 getInstrumentation().waitForIdleSync(); | 75 getInstrumentation().waitForIdleSync(); |
76 return onStartContentIntentHelper.getIntentUrl(); | 76 return onStartContentIntentHelper.getIntentUrl(); |
77 } | 77 } |
78 | 78 |
79 /** | 79 /** |
80 * Scrolls to the node with the provided id, taps on it and waits for a new
page load to finish. | 80 * Scrolls to the node with the provided id, taps on it and waits for a new
page load to finish. |
81 * Useful when tapping on links that take to other pages. | 81 * Useful when tapping on links that take to other pages. |
82 * @param id Id of the node to scroll and tap. | 82 * @param id Id of the node to scroll and tap. |
83 * @return The content url of the received intent or null if none. | 83 * @return The content url of the received intent or null if none. |
84 */ | 84 */ |
85 protected void scrollAndTapNavigatingOut(String id) throws Throwable { | 85 protected void scrollAndTapNavigatingOut(String id) throws Throwable { |
86 TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHel
perContainer(); | 86 TestCallbackHelperContainer callbackHelperContainer = getTestCallbackHel
perContainer(); |
87 OnPageFinishedHelper onPageFinishedHelper = | 87 OnPageFinishedHelper onPageFinishedHelper = |
88 callbackHelperContainer.getOnPageFinishedHelper(); | 88 callbackHelperContainer.getOnPageFinishedHelper(); |
89 int currentCallCount = onPageFinishedHelper.getCallCount(); | 89 int currentCallCount = onPageFinishedHelper.getCallCount(); |
90 | 90 |
91 DOMUtils.scrollNodeIntoView(getContentViewCore(), id); | 91 DOMUtils.scrollNodeIntoView(getWebContents(), id); |
92 DOMUtils.clickNode(this, getContentViewCore(), id); | 92 DOMUtils.clickNode(this, getContentViewCore(), id); |
93 | 93 |
94 onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_S
ECONDS, | 94 onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_S
ECONDS, |
95 TimeUnit.SECONDS); | 95 TimeUnit.SECONDS); |
96 getInstrumentation().waitForIdleSync(); | 96 getInstrumentation().waitForIdleSync(); |
97 } | 97 } |
98 } | 98 } |
OLD | NEW |