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

Unified Diff: chrome/test/data/extensions/api_test/webrequest/framework.js

Issue 1997253002: webRequest: Set frameId on beacon/ping requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webRequest-tabId
Patch Set: Re-use dispatchWillSendRequest Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/webrequest/test_types.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/webrequest/framework.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/framework.js b/chrome/test/data/extensions/api_test/webrequest/framework.js
index c634652a0808acc100fa0d86f12ab8a396137041..5235846cf5d619f131b0350aa8eb09d102910dcb 100644
--- a/chrome/test/data/extensions/api_test/webrequest/framework.js
+++ b/chrome/test/data/extensions/api_test/webrequest/framework.js
@@ -181,9 +181,20 @@ function isUnexpectedDetachedRequest(name, details) {
// Only return true if there is no matching expectation for the given details.
return !expectedEventData.some(function(exp) {
- return name === exp.event &&
+ var didMatchTabAndFrameId =
exp.details.tabId === -1 &&
- exp.details.frameId === -1 &&
+ exp.details.frameId === -1;
+
+ // Accept non-matching tabId/frameId for ping/beacon requests because these
+ // requests can continue after a frame is removed. And due to a bug, such
+ // requests have a tabId/frameId of -1.
+ // The test will fail anyway, but then with a helpful error (expectation
+ // differs from actual events) instead of an obscure test timeout.
+ // TODO(robwu): Remove this once https://crbug.com/522129 gets fixed.
+ didMatchTabAndFrameId = didMatchTabAndFrameId || details.type === 'ping';
+
+ return name === exp.event &&
+ didMatchTabAndFrameId &&
exp.details.method === details.method &&
exp.details.url === details.url &&
exp.details.type === details.type;
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/webrequest/test_types.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698