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

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

Issue 7635003: Attempt to fix hanging WebRequestBlocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 var getURL = chrome.extension.getURL; 1 var getURL = chrome.extension.getURL;
2 var deepEq = chrome.test.checkDeepEq; 2 var deepEq = chrome.test.checkDeepEq;
3 var expectedEventData; 3 var expectedEventData;
4 var capturedEventData; 4 var capturedEventData;
5 var expectedEventOrder; 5 var expectedEventOrder;
6 var tabId; 6 var tabId;
7 var testServerPort; 7 var testServerPort;
8 var eventsCaptured; 8 var eventsCaptured;
9 9
10 function runTests(tests) { 10 function runTests(tests) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // an expected value. This is a basic check that the request headers are valid. 108 // an expected value. This is a basic check that the request headers are valid.
109 function checkUserAgent(headers) { 109 function checkUserAgent(headers) {
110 for (var i in headers) { 110 for (var i in headers) {
111 if (headers[i].name.toLowerCase() == "user-agent") 111 if (headers[i].name.toLowerCase() == "user-agent")
112 return headers[i].value.toLowerCase().indexOf("chrome") != -1; 112 return headers[i].value.toLowerCase().indexOf("chrome") != -1;
113 } 113 }
114 return false; 114 return false;
115 } 115 }
116 116
117 function captureEvent(name, details) { 117 function captureEvent(name, details) {
118 console.log("capture " + name + ": " + details.url);
118 // Ignore system-level requests like safebrowsing updates and favicon fetches 119 // Ignore system-level requests like safebrowsing updates and favicon fetches
119 // since they are unpredictable. 120 // since they are unpredictable.
120 if (details.tabId == -1 || details.type == "other" || 121 if (details.tabId == -1 || details.type == "other" ||
121 details.url.match(/\/favicon.ico$/) || 122 details.url.match(/\/favicon.ico$/) ||
122 details.url.match(/https:\/\/dl.google.com/)) 123 details.url.match(/https:\/\/dl.google.com/))
123 return; 124 return;
124 125
125 // Pull the extra per-event options out of the expected data. These let 126 // Pull the extra per-event options out of the expected data. These let
126 // us specify special return values per event. 127 // us specify special return values per event.
127 var currentIndex = capturedEventData.length; 128 var currentIndex = capturedEventData.length;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 234 }
234 helper(chrome.experimental.webRequest.onBeforeRequest); 235 helper(chrome.experimental.webRequest.onBeforeRequest);
235 helper(chrome.experimental.webRequest.onBeforeSendHeaders); 236 helper(chrome.experimental.webRequest.onBeforeSendHeaders);
236 helper(chrome.experimental.webRequest.onAuthRequired); 237 helper(chrome.experimental.webRequest.onAuthRequired);
237 helper(chrome.experimental.webRequest.onSendHeaders); 238 helper(chrome.experimental.webRequest.onSendHeaders);
238 helper(chrome.experimental.webRequest.onResponseStarted); 239 helper(chrome.experimental.webRequest.onResponseStarted);
239 helper(chrome.experimental.webRequest.onBeforeRedirect); 240 helper(chrome.experimental.webRequest.onBeforeRedirect);
240 helper(chrome.experimental.webRequest.onCompleted); 241 helper(chrome.experimental.webRequest.onCompleted);
241 helper(chrome.experimental.webRequest.onErrorOccurred); 242 helper(chrome.experimental.webRequest.onErrorOccurred);
242 } 243 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698