| Index: chrome/test/data/extensions/content_script_inject/js_test.js
|
| diff --git a/chrome/test/data/extensions/content_script_inject/js_test.js b/chrome/test/data/extensions/content_script_inject/js_test.js
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..87a0930e18d460751a8f2f7bed411078d9318bdc
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/content_script_inject/js_test.js
|
| @@ -0,0 +1,33 @@
|
| +// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// A quick and dirty JavaScript test runner.
|
| +
|
| +function assert(truth) {
|
| + if (!truth) {
|
| + throw new Error('Assertion failed');
|
| + }
|
| +}
|
| +
|
| +function runAllTests() {
|
| + // If there was already an error, do nothing. We don't want to muddy
|
| + // up the results.
|
| + if (document.title.indexOf("Error: ") == 0) {
|
| + return;
|
| + }
|
| +
|
| + for (var propName in window) {
|
| + if (typeof window[propName] == "function" &&
|
| + propName.indexOf("test") == 0) {
|
| + try {
|
| + window[propName]();
|
| + document.title += propName + ",";
|
| + } catch (e) {
|
| + // We use document.title to communicate results back to the browser.
|
| + document.title = "Error: " + propName + ': ' + e.message;
|
| + return;
|
| + }
|
| + }
|
| + }
|
| +}
|
|
|