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.
7 // Helper / error handling functions.
10 * Prints a debug message.
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);
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);
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
41 * throw failTest('my reason');
45 function failTest(reason) {
46 var error = new Error(reason);
47 returnToTest('Test failed: ' + error.stack);