// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. /** * Test controller logic - used by unit test harness to embed tests in * conent shell. */ // Clear the console before every test run - this is Firebug specific code. if (typeof console == "object" && typeof console.clear == "function") { console.clear(); } // Some tests may expect and have no way to suppress global errors. var testExpectsGlobalError = false; var testSuppressedGlobalErrors = []; // Set window onerror to make sure that we catch test harness errors across all // browsers. window.onerror = function (message, url, lineNumber) { if (testExpectsGlobalError) { testSuppressedGlobalErrors.push({ message: message }); return; } if (url) { showErrorAndExit( "\n\n" + url + ":" + lineNumber + ":\n" + message + "\n\n"); } else { showErrorAndExit(message); } window.postMessage('unittest-suite-external-error', '*'); }; // Start Dartium/content_shell, unless we are waiting for HTML Imports to load. // HTML Imports allows a document to link to other HTMLs documents via // . It also allows for those other documents to contain //