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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/executescript/http204/background.js
diff --git a/chrome/test/data/extensions/api_test/executescript/http204/background.js b/chrome/test/data/extensions/api_test/executescript/http204/background.js
index 53e3fb98d4dcc4f0bd654cb28487e3a0df7f31f7..b085c5b8c021a8ca546ebe352742e31e2c77a41b 100644
--- a/chrome/test/data/extensions/api_test/executescript/http204/background.js
+++ b/chrome/test/data/extensions/api_test/executescript/http204/background.js
@@ -287,19 +287,33 @@ function checkManifestScriptsAfter204Navigation(tabId) {
allFrames: true,
code: '[' +
'[window.documentStart,' +
- ' window.documentEnd],' +
+ ' window.documentEnd,' +
+ ' performance.timing.domContentLoadedEventStart > 0],' +
'[window.didRunAtDocumentStartUnexpected,' +
' window.didRunAtDocumentEndUnexpected],' +
']',
}, chrome.test.callbackPass(function(results) {
chrome.test.assertEq(2, results.length);
// Main frame. Should not be affected by child frame navigations.
- chrome.test.assertEq([[1, 1], [null, null]], results[0]);
+ chrome.test.assertEq([[1, 1, true], [null, null]], results[0]);
// Child frame.
+ if (!results[1][0][2]) { // = if DOMContentLoaded did not run.
+ // If the 204 reply was handled faster than the parsing of the frame
+ // document, then the DOMContentLoaded event won't be triggered.
+ chrome.test.assertEq([
+ // The 204 navigation was triggered by the page, so the document_start
+ // script should have run by then. But since DOMContentLoaded is not
+ // triggered, the document_end script should not run either.
+ [1, null, false],
+ // Should not inject non-matching scripts.
+ [null, null],
+ ], results[1]);
+ return;
+ }
chrome.test.assertEq([
// Should run the content scripts even after a navigation to 204.
- [1, 1],
+ [1, 1, true],
// Should not inject non-matching scripts.
[null, null],
], results[1]);
« 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