Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: chrome/test/data/extensions/api_test/executescript/navigation_race/test.js

Issue 2847313002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/process_management_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 = "/extensions/test_file.txt"; 6 var path = "/extensions/test_file.txt";
7 var urlA = "http://a.com:" + config.testServer.port + path; 7 var urlC = "http://c.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
17 // the script, so it's still showing a.com, where we don't have 17 // the script, so it's still showing a.com, where we don't have
18 // permission to run it. 18 // permission to run it.
19 if (chrome.runtime.lastError) { 19 if (chrome.runtime.lastError) {
20 chrome.test.assertLastError( 20 chrome.test.assertLastError(
21 'Cannot access contents of url "' + urlA + 21 'Cannot access contents of url "' + urlC +
22 '". Extension manifest must request permission to access this ' + 22 '". Extension manifest must request permission to access this ' +
23 'host.'); 23 'host.');
24 chrome.test.notifyPass(); 24 chrome.test.notifyPass();
25 } else { 25 } else {
26 // If there were no errors, then the script did run, but it should 26 // If there were no errors, then the script did run, but it should
27 // have run on on b.com (where we do have permission). 27 // have run on on b.com (where we do have permission).
28 chrome.tabs.get(tabId, function(tab) { 28 chrome.tabs.get(tabId, function(tab) {
29 chrome.test.assertTrue( 29 chrome.test.assertTrue(
30 tab.title.indexOf("hi, I'm on http://b.com:") == 0); 30 tab.title.indexOf("hi, I'm on http://b.com:") == 0);
31 chrome.test.notifyPass(); 31 chrome.test.notifyPass();
32 }); 32 });
33 } 33 }
34 }); 34 });
35 } 35 }
36 } 36 }
37 37
38 chrome.tabs.onUpdated.addListener(onTabUpdated); 38 chrome.tabs.onUpdated.addListener(onTabUpdated);
39 chrome.tabs.create({url: urlA}, function(tab) { 39 chrome.tabs.create({url: urlC}, function(tab) {
40 testTabId = tab.id; 40 testTabId = tab.id;
41 }); 41 });
42 }); 42 });
OLDNEW
« no previous file with comments | « chrome/browser/extensions/process_management_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698