| 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 chrome.test.getConfig(function(config) { | 5 chrome.test.getConfig(function(config) { |
| 6 var path = "/files/extensions/test_file.txt"; | 6 var path = "/extensions/test_file.txt"; |
| 7 var urlA = "http://a.com:" + config.testServer.port + path; | 7 var urlA = "http://a.com:" + config.testServer.port + path; |
| 8 var urlB = "http://b.com:" + config.testServer.port + path; | 8 var urlB = "http://b.com:" + config.testServer.port + path; |
| 9 var testTabId; | 9 var testTabId; |
| 10 | 10 |
| 11 function onTabUpdated(tabId, changeInfo, tab) { | 11 function onTabUpdated(tabId, changeInfo, tab) { |
| 12 if (testTabId == tab.id && tab.status == "complete") { | 12 if (testTabId == tab.id && tab.status == "complete") { |
| 13 chrome.tabs.onUpdated.removeListener(onTabUpdated); | 13 chrome.tabs.onUpdated.removeListener(onTabUpdated); |
| 14 chrome.tabs.update(tabId, {url: urlB}); | 14 chrome.tabs.update(tabId, {url: urlB}); |
| 15 executeCodeInTab(testTabId, function() { | 15 executeCodeInTab(testTabId, function() { |
| 16 // Generally, the tab navigation hasn't happened by the time we execute | 16 // Generally, the tab navigation hasn't happened by the time we execute |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 }); | 33 }); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 chrome.tabs.onUpdated.addListener(onTabUpdated); | 37 chrome.tabs.onUpdated.addListener(onTabUpdated); |
| 38 chrome.tabs.create({url: urlA}, function(tab) { | 38 chrome.tabs.create({url: urlA}, function(tab) { |
| 39 testTabId = tab.id; | 39 testTabId = tab.id; |
| 40 }); | 40 }); |
| 41 }); | 41 }); |
| OLD | NEW |