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

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

Issue 1853283002: Map webRequest filter type to multiple internal ResourceTypes if needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | chrome/test/data/extensions/api_test/webrequest/test_types.js » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 getURL = chrome.extension.getURL; 5 var getURL = chrome.extension.getURL;
6 var deepEq = chrome.test.checkDeepEq; 6 var deepEq = chrome.test.checkDeepEq;
7 var expectedEventData; 7 var expectedEventData;
8 var capturedEventData; 8 var capturedEventData;
9 var capturedUnexpectedData; 9 var capturedUnexpectedData;
10 var expectedEventOrder; 10 var expectedEventOrder;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // extraInfoSpec: the union of all desired extraInfoSpecs for the events. 91 // extraInfoSpec: the union of all desired extraInfoSpecs for the events.
92 function expect(data, order, filter, extraInfoSpec) { 92 function expect(data, order, filter, extraInfoSpec) {
93 expectedEventData = data || []; 93 expectedEventData = data || [];
94 capturedEventData = []; 94 capturedEventData = [];
95 capturedUnexpectedData = []; 95 capturedUnexpectedData = [];
96 expectedEventOrder = order || []; 96 expectedEventOrder = order || [];
97 if (expectedEventData.length > 0) { 97 if (expectedEventData.length > 0) {
98 eventsCaptured = chrome.test.callbackAdded(); 98 eventsCaptured = chrome.test.callbackAdded();
99 } 99 }
100 tabAndFrameUrls = {}; // Maps "{tabId}-{frameId}" to the URL of the frame. 100 tabAndFrameUrls = {}; // Maps "{tabId}-{frameId}" to the URL of the frame.
101 frameIdMap = {"-1": -1}; 101 frameIdMap = {"-1": -1, "0": 0};
102 removeListeners(); 102 removeListeners();
103 resetDeclarativeRules(); 103 resetDeclarativeRules();
104 initListeners(filter || {urls: ["<all_urls>"]}, extraInfoSpec || []); 104 initListeners(filter || {urls: ["<all_urls>"]}, extraInfoSpec || []);
105 // Fill in default values. 105 // Fill in default values.
106 for (var i = 0; i < expectedEventData.length; ++i) { 106 for (var i = 0; i < expectedEventData.length; ++i) {
107 if (!('method' in expectedEventData[i].details)) { 107 if (!('method' in expectedEventData[i].details)) {
108 expectedEventData[i].details.method = "GET"; 108 expectedEventData[i].details.method = "GET";
109 } 109 }
110 if (!('tabId' in expectedEventData[i].details)) { 110 if (!('tabId' in expectedEventData[i].details)) {
111 expectedEventData[i].details.tabId = tabIdMap[tabId]; 111 expectedEventData[i].details.tabId = tabIdMap[tabId];
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 helper('onHeadersReceived'); 402 helper('onHeadersReceived');
403 helper('onResponseStarted'); 403 helper('onResponseStarted');
404 helper('onBeforeRedirect'); 404 helper('onBeforeRedirect');
405 helper('onCompleted'); 405 helper('onCompleted');
406 helper('onErrorOccurred'); 406 helper('onErrorOccurred');
407 } 407 }
408 408
409 function resetDeclarativeRules() { 409 function resetDeclarativeRules() {
410 chrome.declarativeWebRequest.onRequest.removeRules(); 410 chrome.declarativeWebRequest.onRequest.removeRules();
411 } 411 }
OLDNEW
« 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