| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var failed = false; | 5 var failed = false; |
| 6 | 6 |
| 7 function did_fail() { | 7 function did_fail() { |
| 8 return failed; | 8 return failed; |
| 9 } | 9 } |
| 10 | 10 |
| 11 function set_failed(val) { | 11 function set_failed(val) { |
| 12 failed = val; | 12 failed = val; |
| 13 } | 13 } |
| 14 | 14 |
| 15 function fail() { | 15 function fail() { |
| 16 set_failed(true); | 16 set_failed(true); |
| 17 if (!did_fail()) { | 17 if (!did_fail()) { |
| 18 chrome.test.fail(); | 18 chrome.test.fail(); |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 var test_url = "http://localhost:PORT/files/extensions/test_file.html"; | 22 var test_url = "http://localhost:PORT/extensions/test_file.html"; |
| 23 | 23 |
| 24 // For running in normal chrome (ie outside of the browser_tests environment), | 24 // For running in normal chrome (ie outside of the browser_tests environment), |
| 25 // set debug to 1 here. | 25 // set debug to 1 here. |
| 26 var debug = 0; | 26 var debug = 0; |
| 27 if (debug) { | 27 if (debug) { |
| 28 test_url = "http://www.google.com"; | 28 test_url = "http://www.google.com"; |
| 29 chrome.test.log = function(msg) { console.log(msg) }; | 29 chrome.test.log = function(msg) { console.log(msg) }; |
| 30 chrome.test.runTests = function(tests) { | 30 chrome.test.runTests = function(tests) { |
| 31 for (var i in tests) { | 31 for (var i in tests) { |
| 32 tests[i](); | 32 tests[i](); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (debug) { | 71 if (debug) { |
| 72 runTests(); | 72 runTests(); |
| 73 } else { | 73 } else { |
| 74 chrome.test.getConfig(function(config) { | 74 chrome.test.getConfig(function(config) { |
| 75 test_url = test_url.replace(/PORT/, config.testServer.port); | 75 test_url = test_url.replace(/PORT/, config.testServer.port); |
| 76 runTests(); | 76 runTests(); |
| 77 }); | 77 }); |
| 78 } | 78 } |
| OLD | NEW |