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

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

Issue 8879051: Revert 113785 - Enable TransferNavigationResourceHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 6
7 // Constants as functions, not to be called until after runTests. 7 // Constants as functions, not to be called until after runTests.
8 function getURLEchoUserAgent() { 8 function getURLEchoUserAgent() {
9 return getServerURL('echoheader?User-Agent'); 9 return getServerURL('echoheader?User-Agent');
10 } 10 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders", 119 ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders",
120 "onHeadersReceived", "onErrorOccurred"] 120 "onHeadersReceived", "onErrorOccurred"]
121 ], 121 ],
122 {urls: ["<all_urls>"]}, // filter 122 {urls: ["<all_urls>"]}, // filter
123 ["blocking"]); 123 ["blocking"]);
124 navigateAndWait(getURLHttpSimpleLoad()); 124 navigateAndWait(getURLHttpSimpleLoad());
125 }, 125 },
126 126
127 // Navigates to a page with a blocking handler that redirects to a different 127 // Navigates to a page with a blocking handler that redirects to a different
128 // page. 128 // page.
129 // TODO(mpcomplete): We should see an onBeforeRedirect as well, but our
130 // process switching logic cancels the original redirect request and
131 // starts a new one instead. See http://crbug.com/79520.
129 function complexLoadRedirected() { 132 function complexLoadRedirected() {
130 expect( 133 expect(
131 [ // events 134 [ // events
132 { label: "onBeforeRequest-1", 135 { label: "onBeforeRequest-1",
133 event: "onBeforeRequest", 136 event: "onBeforeRequest",
134 details: { 137 details: {
135 url: getURL("complexLoad/a.html"), 138 url: getURL("complexLoad/a.html"),
136 frameUrl: getURL("complexLoad/a.html") 139 frameUrl: getURL("complexLoad/a.html")
137 }, 140 },
138 retval: {redirectUrl: getURL("simpleLoad/a.html")} 141 retval: {redirectUrl: getURL("simpleLoad/a.html")}
139 }, 142 },
140 { label: "onBeforeRedirect", 143 { label: "onErrorOccurred-1",
141 event: "onBeforeRedirect", 144 event: "onErrorOccurred",
142 details: { 145 details: {
143 url: getURL("complexLoad/a.html"), 146 url: getURL("complexLoad/a.html"),
144 redirectUrl: getURL("simpleLoad/a.html"),
145 statusLine: "",
146 statusCode: -1,
147 fromCache: false, 147 fromCache: false,
148 error: "net::ERR_ABORTED"
149 // Request to chrome-extension:// url has no IP.
148 } 150 }
149 }, 151 },
150 { label: "onBeforeRequest-2", 152 { label: "onBeforeRequest-2",
151 event: "onBeforeRequest", 153 event: "onBeforeRequest",
152 details: { 154 details: {
153 url: getURL("simpleLoad/a.html"), 155 url: getURL("simpleLoad/a.html"),
154 frameUrl: getURL("simpleLoad/a.html"), 156 frameUrl: getURL("simpleLoad/a.html"),
155 }, 157 },
156 }, 158 },
157 { label: "onResponseStarted", 159 { label: "onResponseStarted",
(...skipping 11 matching lines...) Expand all
169 details: { 171 details: {
170 url: getURL("simpleLoad/a.html"), 172 url: getURL("simpleLoad/a.html"),
171 fromCache: false, 173 fromCache: false,
172 statusCode: 200, 174 statusCode: 200,
173 statusLine: "HTTP/1.1 200 OK", 175 statusLine: "HTTP/1.1 200 OK",
174 // Request to chrome-extension:// url has no IP. 176 // Request to chrome-extension:// url has no IP.
175 } 177 }
176 }, 178 },
177 ], 179 ],
178 [ // event order 180 [ // event order
179 ["onBeforeRequest-1", "onBeforeRedirect", "onBeforeRequest-2", 181 ["onBeforeRequest-1", "onErrorOccurred-1", "onBeforeRequest-2",
180 "onResponseStarted", "onCompleted"], 182 "onResponseStarted", "onCompleted"],
181 ], 183 ],
182 {urls: ["<all_urls>"]}, // filter 184 {urls: ["<all_urls>"]}, // filter
183 ["blocking"]); 185 ["blocking"]);
184 navigateAndWait(getURL("complexLoad/a.html")); 186 navigateAndWait(getURL("complexLoad/a.html"));
185 }, 187 },
186 188
187 // Loads a testserver page that echoes the User-Agent header that was 189 // Loads a testserver page that echoes the User-Agent header that was
188 // sent to fetch it. We modify the outgoing User-Agent in 190 // sent to fetch it. We modify the outgoing User-Agent in
189 // onBeforeSendHeaders, so we should see that modified version. 191 // onBeforeSendHeaders, so we should see that modified version.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 452 }
451 }, 453 },
452 { label: "onHeadersReceived", 454 { label: "onHeadersReceived",
453 event: "onHeadersReceived", 455 event: "onHeadersReceived",
454 details: { 456 details: {
455 url: getURLNonUTF8SetCookie(), 457 url: getURLNonUTF8SetCookie(),
456 statusLine: "HTTP/1.0 200 OK", 458 statusLine: "HTTP/1.0 200 OK",
457 responseHeadersExist: true, 459 responseHeadersExist: true,
458 }, 460 },
459 retval_function: function(name, details) { 461 retval_function: function(name, details) {
462 console.log(JSON.stringify(details));
460 responseHeaders = details.responseHeaders; 463 responseHeaders = details.responseHeaders;
461 var found = false; 464 var found = false;
462 var expectedValue = [ 465 var expectedValue = [
463 "F".charCodeAt(0), 466 "F".charCodeAt(0),
464 "o".charCodeAt(0), 467 "o".charCodeAt(0),
465 "o".charCodeAt(0), 468 "o".charCodeAt(0),
466 0x3D, 0xFE, 0xD1 469 0x3D, 0xFE, 0xD1
467 ]; 470 ];
468 471
469 for (var i = 0; i < responseHeaders.length; ++i) { 472 for (var i = 0; i < responseHeaders.length; ++i) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 // Check the page content for our modified User-Agent string. 625 // Check the page content for our modified User-Agent string.
623 navigateAndWait(getURL("simpleLoad/a.html"), function() { 626 navigateAndWait(getURL("simpleLoad/a.html"), function() {
624 var req = new XMLHttpRequest(); 627 var req = new XMLHttpRequest();
625 var asynchronous = false; 628 var asynchronous = false;
626 req.open("GET", getURLHttpXHRData(), asynchronous); 629 req.open("GET", getURLHttpXHRData(), asynchronous);
627 req.send(null); 630 req.send(null);
628 navigateAndWait(getURL("complexLoad/b.jpg")); 631 navigateAndWait(getURL("complexLoad/b.jpg"));
629 }); 632 });
630 }, 633 },
631 ]); 634 ]);
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698