| OLD | NEW |
| 1 // tabs api test | 1 // tabs api test |
| 2 // browser_tests.exe --gtest_filter=ExtensionApiTest.TabConnect | 2 // browser_tests.exe --gtest_filter=ExtensionApiTest.TabConnect |
| 3 | 3 |
| 4 // We have a bunch of places where we need to remember some state from one | 4 // We have a bunch of places where we need to remember some state from one |
| 5 // test (or setup code) to subsequent tests. | 5 // test (or setup code) to subsequent tests. |
| 6 var testTabId = null; | 6 var testTabId = null; |
| 7 | 7 |
| 8 var pass = chrome.test.callbackPass; | 8 var pass = chrome.test.callbackPass; |
| 9 var assertEq = chrome.test.assertEq; | 9 var assertEq = chrome.test.assertEq; |
| 10 var assertTrue = chrome.test.assertTrue; | 10 var assertTrue = chrome.test.assertTrue; |
| 11 var callbackFail = chrome.test.callbackFail; | 11 var callbackFail = chrome.test.callbackFail; |
| 12 var fail = chrome.test.fail; | 12 var fail = chrome.test.fail; |
| 13 | 13 |
| 14 chrome.test.getConfig(function(config) { | 14 chrome.test.getConfig(function(config) { |
| 15 | 15 |
| 16 chrome.test.runTests([ | 16 chrome.test.runTests([ |
| 17 function setupConnect() { | 17 function setupConnect() { |
| 18 // The web page that our content script will be injected into. | 18 // The web page that our content script will be injected into. |
| 19 var relativePath = '/files/extensions/api_test/tabs/basics/relative.html'; | 19 var relativePath = '/extensions/api_test/tabs/basics/relative.html'; |
| 20 var testUrl = | 20 var testUrl = |
| 21 ['http://localhost:PORT'.replace(/PORT/, config.testServer.port), | 21 ['http://localhost:PORT'.replace(/PORT/, config.testServer.port), |
| 22 relativePath].join(''); | 22 relativePath].join(''); |
| 23 | 23 |
| 24 setupWindow([testUrl], pass(function(winId, tabIds) { | 24 setupWindow([testUrl], pass(function(winId, tabIds) { |
| 25 testTabId = tabIds[0]; | 25 testTabId = tabIds[0]; |
| 26 waitForAllTabs(pass()); | 26 waitForAllTabs(pass()); |
| 27 })); | 27 })); |
| 28 }, | 28 }, |
| 29 | 29 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 var errorMsg = | 115 var errorMsg = |
| 116 "Could not establish connection. Receiving end does not exist."; | 116 "Could not establish connection. Receiving end does not exist."; |
| 117 chrome.tabs.create({}, pass(function(tab) { | 117 chrome.tabs.create({}, pass(function(tab) { |
| 118 chrome.tabs.remove(tab.id, pass(function() { | 118 chrome.tabs.remove(tab.id, pass(function() { |
| 119 chrome.tabs.sendRequest(tab.id, "test", callbackFail(errorMsg)); | 119 chrome.tabs.sendRequest(tab.id, "test", callbackFail(errorMsg)); |
| 120 })); | 120 })); |
| 121 })); | 121 })); |
| 122 } | 122 } |
| 123 ]); | 123 ]); |
| 124 }); | 124 }); |
| OLD | NEW |