Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e04500338fe0d7a8e2bf40a9a728ef45022713df |
| --- /dev/null |
| +++ b/chrome/test/data/android/webvr_instrumentation/resources/webvr_e2e.js |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var testPassed = false; |
| +var resultString = ""; |
| +var asyncCounter = 0; |
| +var javascriptDone = false; |
| +var vrDisplayPromiseDone = false; |
| + |
| +function finishJavascriptStep() { |
| + javascriptDone = true; |
| +} |
| + |
| +function checkResultsForFailures(tests, harness_status) { |
| + testPassed = true; |
| + if (harness_status["status"] != 0) { |
| + testPassed = false; |
| + resultString += "Harness failed due to " + |
| + (harness_status["status"] == 1 ? "error" : "timeout") |
| + + ". "; |
| + } |
| + for (var test in tests) { |
| + let passed = (tests[test]["status"] == 0); |
| + if (!passed) { |
| + testPassed = false; |
| + resultString += "FAIL "; |
| + } else { |
| + resultString += "PASS "; |
| + } |
| + resultString += tests[test]["name"] + |
| + (passed ? "" : (": " + tests[test]["message"])) + |
| + ". "; |
|
Lei Lei
2017/02/16 22:04:50
How about setting resultString to JSON.stringify(t
bsheedy
2017/02/16 23:30:14
I feel like that ends up being too verbose. For a
Lei Lei
2017/02/17 00:18:14
It is fine to keep it short, what is the message i
bsheedy
2017/02/17 17:58:10
An example of a test failing when reaching an asse
|
| + } |
| +} |
| + |
| +add_completion_callback( (tests, harness_status) => { |
| + checkResultsForFailures(tests, harness_status); |
| + console.debug("Test result: " + (testPassed ? "Pass" : "Fail")); |
| + console.debug("Test result string: " + resultString); |
| + finishJavascriptStep(); |
| +}); |