[MacViews] Show comboboxes with a native NSMenu
[chromium-blink-merge.git] / chrome / test / data / webui / async.js
blobe21fd63a5d4ce740167961edbbb39aacf068af75
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /**
6 * Fails always.
7 * @throw {Error}
8 */
9 function testFailsAssert() {
10 assertNotReached();
11 chrome.send('testContinues');
12 assertNotReached();
15 /**
16 * Records failure.
18 function testFailsExpect() {
19 expectNotReached();
20 chrome.send('testContinues');
21 expectNotReached();
24 /**
25 * Passes and sends testDone message for browser_test to call
26 * testDone().
28 function testPasses() {
29 expectTrue(true);
30 chrome.send('testContinues');
31 assertFalse(false);
34 function testAsyncDoneFailFirstSyncPass() {
35 expectNotReached();
36 chrome.send('testContinues');
39 /**
40 * Wraps the function represented by |name| similar to the way net_internals
41 * tests are wrapped.
42 * @param {string} name The name of the function to run.
44 function runAsync(name) {
45 // Strip |name| from arguments.
46 var testArguments = Array.prototype.slice.call(arguments, 1);
48 // call async function.
49 var result = runTestFunction(name, this[name], testArguments);
51 // Pass on success; bail on errors.
52 if (result[0]) {
53 chrome.send('testPasses');
54 } else {
55 chrome.send('testFails');
56 testDone(result);
60 /**
61 * Sends a message to handler to start |testName| and returns.
62 * @param {string} testName The name of the test to run.
64 function startAsyncTest(testName) {
65 chrome.send('startAsyncTest', [testName]);