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 JSON.parse = function() { | 5 JSON.parse = function() { |
6 return "JSON.parse clobbered by extension."; | 6 return "JSON.parse clobbered by extension."; |
7 }; | 7 }; |
8 | 8 |
9 JSON.stringify = function() { | 9 JSON.stringify = function() { |
10 return "JSON.stringify clobbered by extension."; | 10 return "JSON.stringify clobbered by extension."; |
11 }; | 11 }; |
12 | 12 |
13 Array.prototype.toJSON = function() { | 13 Array.prototype.toJSON = function() { |
14 return "Array.prototype.toJSON clobbered by extension."; | 14 return "Array.prototype.toJSON clobbered by extension."; |
15 }; | 15 }; |
16 | 16 |
17 Object.prototype.toJSON = function() { | 17 Object.prototype.toJSON = function() { |
18 return "Object.prototype.toJSON clobbered by extension."; | 18 return "Object.prototype.toJSON clobbered by extension."; |
19 }; | 19 }; |
20 | 20 |
21 // Keep track of the tab that we're running tests in, for simplicity. | 21 // Keep track of the tab that we're running tests in, for simplicity. |
22 var testTab = null; | 22 var testTab = null; |
23 | 23 |
24 chrome.test.getConfig(function(config) { | 24 chrome.test.getConfig(function(config) { |
25 chrome.test.runTests([ | 25 chrome.test.runTests([ |
26 function setupTestTab() { | 26 function setupTestTab() { |
27 chrome.test.log("Creating tab..."); | 27 chrome.test.log("Creating tab..."); |
28 chrome.tabs.create({ | 28 chrome.tabs.create({ |
29 url: "http://localhost:PORT/files/extensions/test_file.html" | 29 url: "http://localhost:PORT/extensions/test_file.html" |
30 .replace(/PORT/, config.testServer.port) | 30 .replace(/PORT/, config.testServer.port) |
31 }, function(newTab) { | 31 }, function(newTab) { |
32 chrome.tabs.onUpdated.addListener(function listener(_, info, tab) { | 32 chrome.tabs.onUpdated.addListener(function listener(_, info, tab) { |
33 if (tab.id == newTab.id && info.status == 'complete') { | 33 if (tab.id == newTab.id && info.status == 'complete') { |
34 chrome.test.log("Created tab: " + tab.url); | 34 chrome.test.log("Created tab: " + tab.url); |
35 chrome.tabs.onUpdated.removeListener(listener); | 35 chrome.tabs.onUpdated.removeListener(listener); |
36 testTab = tab; | 36 testTab = tab; |
37 chrome.test.succeed(); | 37 chrome.test.succeed(); |
38 } | 38 } |
39 }); | 39 }); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } catch(e) { | 191 } catch(e) { |
192 error = e; | 192 error = e; |
193 } | 193 } |
194 chrome.test.assertTrue(error != undefined); | 194 chrome.test.assertTrue(error != undefined); |
195 | 195 |
196 chrome.test.succeed(); | 196 chrome.test.succeed(); |
197 }, | 197 }, |
198 | 198 |
199 ]); | 199 ]); |
200 }); | 200 }); |
OLD | NEW |