| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 assertEq = chrome.test.assertEq; | 5 var assertEq = chrome.test.assertEq; |
| 6 var assertTrue = chrome.test.assertTrue; | 6 var assertTrue = chrome.test.assertTrue; |
| 7 var pass = chrome.test.callbackPass; | 7 var pass = chrome.test.callbackPass; |
| 8 var callbackFail = chrome.test.callbackFail; | 8 var callbackFail = chrome.test.callbackFail; |
| 9 var listenForever = chrome.test.listenForever; | 9 var listenForever = chrome.test.listenForever; |
| 10 | 10 |
| 11 var testTabId; | 11 var testTabId; |
| 12 var port; | 12 var port; |
| 13 | 13 |
| 14 function testUrl(domain) { | 14 function testUrl(domain) { |
| 15 return 'http://' + domain + ':' + port + | 15 return 'http://' + domain + ':' + port + |
| 16 '/files/extensions/test_file.html'; | 16 '/extensions/test_file.html'; |
| 17 } | 17 } |
| 18 | 18 |
| 19 function error(domain) { | 19 function error(domain) { |
| 20 return 'Cannot access contents of url "' + testUrl(domain) + '".' + | 20 return 'Cannot access contents of url "' + testUrl(domain) + '".' + |
| 21 ' Extension manifest must request permission to access this host.'; | 21 ' Extension manifest must request permission to access this host.'; |
| 22 } | 22 } |
| 23 | 23 |
| 24 // Creates a new tab, navigated to the specified |domain|. | 24 // Creates a new tab, navigated to the specified |domain|. |
| 25 function createTestTab(domain, callback) { | 25 function createTestTab(domain, callback) { |
| 26 var createdTabId = -1; | 26 var createdTabId = -1; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 tab.id, {code: 'document.title = "success"'}, | 103 tab.id, {code: 'document.title = "success"'}, |
| 104 pass(function() { | 104 pass(function() { |
| 105 chrome.tabs.get(tab.id, pass(function(tab) { | 105 chrome.tabs.get(tab.id, pass(function(tab) { |
| 106 assertEq('success', tab.title); | 106 assertEq('success', tab.title); |
| 107 })); | 107 })); |
| 108 })); | 108 })); |
| 109 })); | 109 })); |
| 110 } | 110 } |
| 111 ]); | 111 ]); |
| 112 }); | 112 }); |
| OLD | NEW |