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

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

Issue 2335133003: PlzNavigate: support the WebRequest API (Closed)
Patch Set: PlzNavigate: support the WebRequest API Created 4 years, 3 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
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 // Constants as functions, not to be called until after runTests. 5 // Constants as functions, not to be called until after runTests.
6 function getURLHttpSimpleLoad() { 6 function getURLHttpSimpleLoad() {
7 return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html'); 7 return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html');
8 } 8 }
9 9
10 function getURLHttpSimpleLoadRedirect() { 10 function getURLHttpSimpleLoadRedirect() {
(...skipping 28 matching lines...) Expand all
39 url: getURL("simpleLoad/a.html"), 39 url: getURL("simpleLoad/a.html"),
40 statusCode: 200, 40 statusCode: 200,
41 fromCache: false, 41 fromCache: false,
42 statusLine: "HTTP/1.1 200 OK", 42 statusLine: "HTTP/1.1 200 OK",
43 // Request to chrome-extension:// url has no IP. 43 // Request to chrome-extension:// url has no IP.
44 } 44 }
45 }, 45 },
46 ], 46 ],
47 [ // event order 47 [ // event order
48 ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted"] ]); 48 ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted"] ]);
49 console.log("Before simple load");
Devlin 2016/09/16 16:17:26 nit: remove debugging logs
clamy 2016/09/19 15:10:03 Done.
49 navigateAndWait(getURL("simpleLoad/a.html")); 50 navigateAndWait(getURL("simpleLoad/a.html"));
51 console.log("After simple load");
50 }, 52 },
51 53
52 // Navigates to a blank page via HTTP. Only HTTP requests get the 54 // Navigates to a blank page via HTTP. Only HTTP requests get the
53 // onBeforeSendHeaders event. 55 // onBeforeSendHeaders event.
54 function simpleLoadHttp() { 56 function simpleLoadHttp() {
55 expect( 57 expect(
56 [ // events 58 [ // events
57 { label: "onBeforeRequest-1", 59 { label: "onBeforeRequest-1",
58 event: "onBeforeRequest", 60 event: "onBeforeRequest",
59 details: { 61 details: {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 151 }
150 } 152 }
151 ], 153 ],
152 [ // event order 154 [ // event order
153 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1", 155 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1",
154 "onHeadersReceived-1", "onBeforeRedirect", 156 "onHeadersReceived-1", "onBeforeRedirect",
155 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2", 157 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2",
156 "onHeadersReceived-2", "onResponseStarted", "onCompleted"] ], 158 "onHeadersReceived-2", "onResponseStarted", "onCompleted"] ],
157 {urls: ["<all_urls>"]}, // filter 159 {urls: ["<all_urls>"]}, // filter
158 ["requestHeaders", "responseHeaders"]); 160 ["requestHeaders", "responseHeaders"]);
161 console.log("Before simple load redirect");
159 navigateAndWait(getURLHttpSimpleLoadRedirect()); 162 navigateAndWait(getURLHttpSimpleLoadRedirect());
163 console.log("After simple load redirect");
160 }, 164 },
161 165
162 // Navigates to a non-existing page. 166 // Navigates to a non-existing page.
163 function nonExistingLoad() { 167 function nonExistingLoad() {
164 expect( 168 expect(
165 [ // events 169 [ // events
166 { label: "onBeforeRequest", 170 { label: "onBeforeRequest",
167 event: "onBeforeRequest", 171 event: "onBeforeRequest",
168 details: { 172 details: {
169 url: getURL("does_not_exist.html"), 173 url: getURL("does_not_exist.html"),
170 frameUrl: getURL("does_not_exist.html") 174 frameUrl: getURL("does_not_exist.html")
171 } 175 }
172 }, 176 },
173 { label: "onErrorOccurred", 177 { label: "onErrorOccurred",
174 event: "onErrorOccurred", 178 event: "onErrorOccurred",
175 details: { 179 details: {
176 url: getURL("does_not_exist.html"), 180 url: getURL("does_not_exist.html"),
177 fromCache: false, 181 fromCache: false,
178 error: "net::ERR_FILE_NOT_FOUND", 182 error: "net::ERR_FILE_NOT_FOUND",
179 // Request to chrome-extension:// url has no IP. 183 // Request to chrome-extension:// url has no IP.
180 } 184 }
181 }, 185 },
182 ], 186 ],
183 [ // event order 187 [ // event order
184 ["onBeforeRequest", "onErrorOccurred"] ]); 188 ["onBeforeRequest", "onErrorOccurred"] ]);
189 console.log("Before does not exist");
185 navigateAndWait(getURL("does_not_exist.html")); 190 navigateAndWait(getURL("does_not_exist.html"));
191 console.log("After does not exist");
186 }, 192 },
187 ]); 193 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698