| Index: chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js
|
| diff --git a/chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js b/chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js
|
| index 03f006cb53132eeb496354a78c88589773bbcf45..abf05cb4af39fe5c6adcaacb8e332950c100b672 100644
|
| --- a/chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js
|
| +++ b/chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js
|
| @@ -4,14 +4,28 @@
|
|
|
| var testPassed = false;
|
| var resultString = "";
|
| -var asyncCounter = 0;
|
| var javascriptDone = false;
|
| -var vrDisplayPromiseDone = false;
|
| +var initializationSteps = {load: false};
|
|
|
| function finishJavaScriptStep() {
|
| javascriptDone = true;
|
| }
|
|
|
| +// Used to check when JavaScript is in an acceptable state to start testing
|
| +// after a page load, as Chrome thinking that the page has finished loading
|
| +// is not always sufficient. By default waits until the load event is fired.
|
| +function isInitializationComplete() {
|
| + for (var step in initializationSteps) {
|
| + if (!initializationSteps[step]) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +window.addEventListener("load",
|
| + () => {initializationSteps["load"] = true;}, false);
|
| +
|
| function checkResultsForFailures(tests, harness_status) {
|
| testPassed = true;
|
| if (harness_status["status"] != 0) {
|
| @@ -34,9 +48,13 @@ function checkResultsForFailures(tests, harness_status) {
|
| }
|
| }
|
|
|
| -add_completion_callback( (tests, harness_status) => {
|
| - checkResultsForFailures(tests, harness_status);
|
| - console.debug("Test result: " + (testPassed ? "Pass" : "Fail"));
|
| - console.debug("Test result string: " + resultString);
|
| - finishJavaScriptStep();
|
| -});
|
| +// Only interact with testharness.js if it was actually included on the page
|
| +// before this file
|
| +if (typeof add_completion_callback !== "undefined") {
|
| + add_completion_callback( (tests, harness_status) => {
|
| + checkResultsForFailures(tests, harness_status);
|
| + console.debug("Test result: " + (testPassed ? "Pass" : "Fail"));
|
| + console.debug("Test result string: " + resultString);
|
| + finishJavaScriptStep();
|
| + });
|
| +}
|
|
|