| Index: chrome/test/data/webui/test_api.js
|
| ===================================================================
|
| --- chrome/test/data/webui/test_api.js (revision 94917)
|
| +++ chrome/test/data/webui/test_api.js (working copy)
|
| @@ -493,7 +493,6 @@
|
| * @see createExpect
|
| **/
|
| function runTest(testFunction, testArguments) {
|
| - errors.splice(0, errors.length);
|
| // Avoid eval() if at all possible, since it will not work on pages
|
| // that have enabled content-security-policy.
|
| var testBody = this[testFunction]; // global object -- not a method.
|
| @@ -504,6 +503,24 @@
|
| testFunction.name ? testFunction.name : testBody.toString();
|
| console.log('Running test ' + testName);
|
| }
|
| + return runTestFunction(testFunction, testBody, testArguments);
|
| + }
|
| +
|
| + /**
|
| + * This is the guts of WebUIBrowserTest. It clears |errors|, runs the
|
| + * test surrounded by an expect to catch Errors. If |errors| is
|
| + * non-empty, it reports a failure and a message by joining |errors|.
|
| + * Consumers can use this to use assert/expect functions asynchronously,
|
| + * but are then responsible for reporting errors to the browser themselves.
|
| + * @param {string} testFunction The function name to report on failure.
|
| + * @param {Function} testBody The function to call.
|
| + * @param {Array} testArguments The arguments to call |testBody| with.
|
| + * @return {Array.<boolean, string>} [test-succeeded, message-if-failed]
|
| + * @see errors
|
| + * @see createExpect
|
| + **/
|
| + function runTestFunction(testFunction, testBody, testArguments) {
|
| + errors.splice(0, errors.length);
|
| createExpect(testBody).apply(null, testArguments);
|
|
|
| var result = [true];
|
| @@ -719,6 +736,7 @@
|
| window.registerMessageCallback = registerMessageCallback;
|
| window.registerMockMessageCallbacks = registerMockMessageCallbacks;
|
| window.runTest = runTest;
|
| + window.runTestFunction = runTestFunction;
|
| window.SaveArgumentsMatcher = SaveArgumentsMatcher;
|
| window.TEST = TEST;
|
| window.TEST_F = TEST_F;
|
|
|