Elim cr-checkbox
[chromium-blink-merge.git] / chrome / test / data / webrtc / test_functions.js
blob1c102b8b113c16e95debcd313b3b40cb031f015a
1 /**
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
7 // Helper / error handling functions.
9 /**
10 * Prints a debug message.
12 function debug(txt) {
13 console.log(txt);
16 /**
17 * Sends a value back to the test without logging it.
19 * @param {string} message The message to return.
21 function silentReturnToTest(message) {
22 window.domAutomationController.send(message);
25 /**
26 * Sends a value back to the test and logs it.
28 * @param {string} message The message to return.
30 function returnToTest(message) {
31 debug('Returning ' + message + ' to test.');
32 silentReturnToTest(message);
36 /**
37 * Fails the test by generating an exception. If the test automation is calling
38 * into us, make sure to fail the test as fast as possible. You must use this
39 * function like this:
41 * throw failTest('my reason');
43 * @return {!Error}
45 function failTest(reason) {
46 var error = new Error(reason);
47 returnToTest('Test failed: ' + error.stack);
48 return error;