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

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

Issue 1670673003: Refactor the implementation of the webNavigation extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Bug-532666-NavigationHandleAPI
Patch Set: Remove UI thread DCHECKs. Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 config; 5 var config;
6 var MAIN_HOST = 'b.com'; 6 var MAIN_HOST = 'b.com';
7 var OTHER_HOST = 'c.com'; 7 var OTHER_HOST = 'c.com';
8 8
9 var DOMContentLoadedEventsInFrame = []; 9 var DOMContentLoadedEventsInFrame = [];
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 }, 241 },
242 242
243 function verifyCrossOriginManifestAfterCrossOrigin204() { 243 function verifyCrossOriginManifestAfterCrossOrigin204() {
244 checkManifestScriptsAfter204Navigation(tabId); 244 checkManifestScriptsAfter204Navigation(tabId);
245 }, 245 },
246 ]); 246 ]);
247 } 247 }
248 248
249 // Navigates to a page that navigates to a 204 page via a script. 249 // Navigates to a page that navigates to a 204 page via a script.
250 function navigateToFrameAndWaitUntil204Loaded(tabId, hostname, hostname204) { 250 function navigateToFrameAndWaitUntil204Loaded(tabId, hostname, hostname204) {
251 // If the child frame's origin differs from the parent frame's origin, and
252 // site isolation is enabled, then two onErrorOccurred events are expected:
253 // 1. onErrorOccurred for a process swap of the initial frame.
254 // 2. onErrorOccurred for the failed provisional load.
255 // TODO(robwu): Remove this work-around when the navigation is immediately
256 // handled in the right process (so that a process swap is not needed).
257 var expectTwoErrors = MAIN_HOST !== hostname && config.isolateExtensions;
258 var doneListening = chrome.test.listenForever( 251 var doneListening = chrome.test.listenForever(
259 chrome.webNavigation.onErrorOccurred, 252 chrome.webNavigation.onErrorOccurred,
260 function(details) { 253 function(details) {
261 if (details.tabId === tabId && details.frameId > 0) { 254 if (details.tabId === tabId && details.frameId > 0) {
262 if (expectTwoErrors) {
263 // |url| is the initial URL of the iframe, declared below.
264 chrome.test.assertEq(url, details.url);
265 expectTwoErrors = false;
266 return;
267 }
268 chrome.test.assertTrue(details.url.includes('page204.html'), 255 chrome.test.assertTrue(details.url.includes('page204.html'),
269 'frame URL should be page204.html, but was ' + details.url); 256 'frame URL should be page204.html, but was ' + details.url);
270 doneListening(); 257 doneListening();
271 } 258 }
272 }); 259 });
273 260
274 var url = 'http://' + hostname + ':' + config.testServer.port + 261 var url = 'http://' + hostname + ':' + config.testServer.port +
275 '/extensions/api_test/executescript/http204/navigate_to_204.html?' + 262 '/extensions/api_test/executescript/http204/navigate_to_204.html?' +
276 hostname204; 263 hostname204;
277 264
(...skipping 20 matching lines...) Expand all
298 285
299 // Child frame. 286 // Child frame.
300 chrome.test.assertEq([ 287 chrome.test.assertEq([
301 // Should run the content scripts even after a navigation to 204. 288 // Should run the content scripts even after a navigation to 204.
302 [1, 1], 289 [1, 1],
303 // Should not inject non-matching scripts. 290 // Should not inject non-matching scripts.
304 [null, null], 291 [null, null],
305 ], results[1]); 292 ], results[1]);
306 })); 293 }));
307 } 294 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/web_navigation.json ('k') | chrome/test/data/extensions/api_test/webnavigation/api/framework.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698