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

Side by Side Diff: chrome/test/data/extensions/api_test/webrequest/test_blocking.html

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
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/framework.js ('k') | 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 <script src="framework.js"> 1 <script src="framework.js">
2 </script> 2 </script>
3 <script> 3 <script>
4 var pass = chrome.test.callbackPass;
5
4 // Constants as functions, not to be called until after runTests. 6 // Constants as functions, not to be called until after runTests.
5 function getURLEchoUserAgent() { 7 function getURLEchoUserAgent() {
6 return getServerURL('echoheader?User-Agent'); 8 return getServerURL('echoheader?User-Agent');
7 } 9 }
8 10
9 runTests([ 11 runTests([
10 // Navigates to a page with subresources, with a blocking handler that 12 // Navigates to a page with subresources, with a blocking handler that
11 // cancels the page request. The page will not load, and we should not 13 // cancels the page request. The page will not load, and we should not
12 // see the subresources. 14 // see the subresources.
13 function complexLoadCancelled() { 15 function complexLoadCancelled() {
14 expect( 16 expect(
15 [ // events 17 [ // events
16 { label: "onBeforeRequest", 18 { label: "onBeforeRequest",
17 event: "onBeforeRequest", 19 event: "onBeforeRequest",
18 details: { 20 details: {
19 method: "GET", 21 method: "GET",
20 tabId: tabId, 22 tabId: tabId,
21 type: "main_frame", 23 type: "main_frame",
22 url: getURL("complexLoad/a.html"), 24 url: getURL("complexLoad/b.html"),
23 frameUrl: getURL("complexLoad/a.html") 25 frameUrl: getURL("complexLoad/b.html")
24 }, 26 },
25 retval: {cancel: true} 27 retval: {cancel: true}
26 }, 28 },
27 // Cancelling is considered an error. 29 // Cancelling is considered an error.
28 { label: "onErrorOccurred", 30 { label: "onErrorOccurred",
29 event: "onErrorOccurred", 31 event: "onErrorOccurred",
30 details: { 32 details: {
31 url: getURL("complexLoad/a.html"), 33 url: getURL("complexLoad/b.html"),
32 fromCache: false, 34 fromCache: false,
33 error: "net::ERR_EMPTY_RESPONSE" 35 error: "net::ERR_EMPTY_RESPONSE"
34 // Request to chrome-extension:// url has no IP. 36 // Request to chrome-extension:// url has no IP.
35 } 37 }
36 }, 38 },
37 ], 39 ],
38 [ // event order 40 [ // event order
39 ["onBeforeRequest", "onErrorOccurred"] 41 ["onBeforeRequest", "onErrorOccurred"]
40 ], 42 ],
41 {}, // filter 43 {}, // filter
42 ["blocking"]); 44 ["blocking"]);
43 console.log("load canc: navigating to a"); 45 console.log("load canc: navigating to b");
44 navigateAndWait(getURL("complexLoad/a.html")); 46 navigateAndWait(getURL("complexLoad/b.html"), function() {
47 // Workaround for hanging test. For some reason, if we try to load
48 // a new URL in the current tab, it hangs on the buildbot.
49 // See http://crbug.com/91715
50 chrome.tabs.create({url: "about:blank"}, pass(function(tab) {
51 tabId = tab.id;
52 }));
53 });
45 }, 54 },
46 55
47 // Navigates to a page with a blocking handler that redirects to a different 56 // Navigates to a page with a blocking handler that redirects to a different
48 // page. 57 // page.
49 // TODO(mpcomplete): We should see an onBeforeRedirect as well, but our 58 // TODO(mpcomplete): We should see an onBeforeRedirect as well, but our
50 // process switching logic cancels the original redirect request and 59 // process switching logic cancels the original redirect request and
51 // starts a new one instead. See http://crbug.com/79520. 60 // starts a new one instead. See http://crbug.com/79520.
52 function complexLoadRedirected() { 61 function complexLoadRedirected() {
53 expect( 62 expect(
54 [ // events 63 [ // events
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 console.log("mod headers: 3"); 185 console.log("mod headers: 3");
177 chrome.tabs.executeScript(tabId, 186 chrome.tabs.executeScript(tabId,
178 { 187 {
179 code: "chrome.extension.sendRequest(" + 188 code: "chrome.extension.sendRequest(" +
180 "{pass: document.body.innerText.indexOf('FoobarUA') >= 0});" 189 "{pass: document.body.innerText.indexOf('FoobarUA') >= 0});"
181 }); 190 });
182 }); 191 });
183 }, 192 },
184 ]); 193 ]);
185 </script> 194 </script>
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/framework.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698