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

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

Issue 1691453002: Fix flakiness of ExecuteScriptApiTest.FrameWithHttp204 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [1][2] = [1][0][2] 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
« no previous file with comments | « no previous file | 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 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 }); 280 });
281 } 281 }
282 282
283 // Checks whether the content scripts were run as expected in the frame that 283 // Checks whether the content scripts were run as expected in the frame that
284 // just received a failed provisional load (=received 204 reply). 284 // just received a failed provisional load (=received 204 reply).
285 function checkManifestScriptsAfter204Navigation(tabId) { 285 function checkManifestScriptsAfter204Navigation(tabId) {
286 chrome.tabs.executeScript(tabId, { 286 chrome.tabs.executeScript(tabId, {
287 allFrames: true, 287 allFrames: true,
288 code: '[' + 288 code: '[' +
289 '[window.documentStart,' + 289 '[window.documentStart,' +
290 ' window.documentEnd],' + 290 ' window.documentEnd,' +
291 ' performance.timing.domContentLoadedEventStart > 0],' +
291 '[window.didRunAtDocumentStartUnexpected,' + 292 '[window.didRunAtDocumentStartUnexpected,' +
292 ' window.didRunAtDocumentEndUnexpected],' + 293 ' window.didRunAtDocumentEndUnexpected],' +
293 ']', 294 ']',
294 }, chrome.test.callbackPass(function(results) { 295 }, chrome.test.callbackPass(function(results) {
295 chrome.test.assertEq(2, results.length); 296 chrome.test.assertEq(2, results.length);
296 // Main frame. Should not be affected by child frame navigations. 297 // Main frame. Should not be affected by child frame navigations.
297 chrome.test.assertEq([[1, 1], [null, null]], results[0]); 298 chrome.test.assertEq([[1, 1, true], [null, null]], results[0]);
298 299
299 // Child frame. 300 // Child frame.
301 if (!results[1][0][2]) { // = if DOMContentLoaded did not run.
302 // If the 204 reply was handled faster than the parsing of the frame
303 // document, then the DOMContentLoaded event won't be triggered.
304 chrome.test.assertEq([
305 // The 204 navigation was triggered by the page, so the document_start
306 // script should have run by then. But since DOMContentLoaded is not
307 // triggered, the document_end script should not run either.
308 [1, null, false],
309 // Should not inject non-matching scripts.
310 [null, null],
311 ], results[1]);
312 return;
313 }
300 chrome.test.assertEq([ 314 chrome.test.assertEq([
301 // Should run the content scripts even after a navigation to 204. 315 // Should run the content scripts even after a navigation to 204.
302 [1, 1], 316 [1, 1, true],
303 // Should not inject non-matching scripts. 317 // Should not inject non-matching scripts.
304 [null, null], 318 [null, null],
305 ], results[1]); 319 ], results[1]);
306 })); 320 }));
307 } 321 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698