| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.chrome.browser.vr_shell; | 5 package org.chromium.chrome.browser.vr_shell; |
| 6 | 6 |
| 7 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_L
ONG_MS; | 7 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_L
ONG_MS; |
| 8 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_S
HORT_MS; | 8 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_CHECK_INTERVAL_S
HORT_MS; |
| 9 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_LONG_MS; | 9 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_LONG_MS; |
| 10 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS
; | 10 import static org.chromium.chrome.browser.vr_shell.VrUtils.POLL_TIMEOUT_SHORT_MS
; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * Waits for a JavaScript step to finish, asserting that the step finished | 191 * Waits for a JavaScript step to finish, asserting that the step finished |
| 192 * instead of timing out. | 192 * instead of timing out. |
| 193 * @param webContents The WebContents for the tab the JavaScript step is in | 193 * @param webContents The WebContents for the tab the JavaScript step is in |
| 194 */ | 194 */ |
| 195 protected void waitOnJavaScriptStep(WebContents webContents) { | 195 protected void waitOnJavaScriptStep(WebContents webContents) { |
| 196 assertTrue("Polling JavaScript boolean javascriptDone succeeded", | 196 assertTrue("Polling JavaScript boolean javascriptDone timed out", |
| 197 pollJavaScriptBoolean("javascriptDone", POLL_TIMEOUT_LONG_MS, we
bContents)); | 197 pollJavaScriptBoolean("javascriptDone", POLL_TIMEOUT_LONG_MS, we
bContents)); |
| 198 // Reset the synchronization boolean | 198 // Reset the synchronization boolean |
| 199 runJavaScriptOrFail("javascriptDone = false", POLL_TIMEOUT_SHORT_MS, web
Contents); | 199 runJavaScriptOrFail("javascriptDone = false", POLL_TIMEOUT_SHORT_MS, web
Contents); |
| 200 } | 200 } |
| 201 | 201 |
| 202 /** | 202 /** |
| 203 * Executes a JavaScript step function using the given WebContents. | 203 * Executes a JavaScript step function using the given WebContents. |
| 204 * @param stepFunction The JavaScript step function to call | 204 * @param stepFunction The JavaScript step function to call |
| 205 * @param webContents The WebContents for the tab the JavaScript is in | 205 * @param webContents The WebContents for the tab the JavaScript is in |
| 206 */ | 206 */ |
| 207 protected void executeStepAndWait(String stepFunction, WebContents webConten
ts) { | 207 protected void executeStepAndWait(String stepFunction, WebContents webConten
ts) { |
| 208 // Run the step and block | 208 // Run the step and block |
| 209 JavaScriptUtils.executeJavaScript(webContents, stepFunction); | 209 JavaScriptUtils.executeJavaScript(webContents, stepFunction); |
| 210 waitOnJavaScriptStep(webContents); | 210 waitOnJavaScriptStep(webContents); |
| 211 } | 211 } |
| 212 } | 212 } |
| OLD | NEW |