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

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

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All URLs -> all hosts; also rebased Created 7 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 | 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 // 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('files/extensions/api_test/webrequest/simpleLoad/a.html'); 7 return getServerURL('files/extensions/api_test/webrequest/simpleLoad/a.html');
8 } 8 }
9 9
10 function getURLHttpSimpleLoadRedirect() { 10 function getURLHttpSimpleLoadRedirect() {
11 return getServerURL('server-redirect?'+getURLHttpSimpleLoad()); 11 return getServerURL('server-redirect?'+getURLHttpSimpleLoad());
12 } 12 }
13 13
14 // A URL from b.com, which we don't have permission to access.
15 function getURLNotVisible() {
16 return getServerURL('files/extensions/api_test/webrequest/simpleLoad/b.html',
17 'b.com');
18 }
19
20 runTests([ 14 runTests([
21 // Navigates to a blank page. 15 // Navigates to a blank page.
22 function simpleLoad() { 16 function simpleLoad() {
23 expect( 17 expect(
24 [ // events 18 [ // events
25 { label: "a-onBeforeRequest", 19 { label: "a-onBeforeRequest",
26 event: "onBeforeRequest", 20 event: "onBeforeRequest",
27 details: { 21 details: {
28 url: getURL("simpleLoad/a.html"), 22 url: getURL("simpleLoad/a.html"),
29 frameUrl: getURL("simpleLoad/a.html") 23 frameUrl: getURL("simpleLoad/a.html")
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 fromCache: false, 175 fromCache: false,
182 error: "net::ERR_FILE_NOT_FOUND", 176 error: "net::ERR_FILE_NOT_FOUND",
183 // Request to chrome-extension:// url has no IP. 177 // Request to chrome-extension:// url has no IP.
184 } 178 }
185 }, 179 },
186 ], 180 ],
187 [ // event order 181 [ // event order
188 ["onBeforeRequest", "onErrorOccurred"] ]); 182 ["onBeforeRequest", "onErrorOccurred"] ]);
189 navigateAndWait(getURL("does_not_exist.html")); 183 navigateAndWait(getURL("does_not_exist.html"));
190 }, 184 },
191
192 // Navigates to a page that we don't have access to, then a blank page.
193 // We should not see the first navigation.
194 function simpleLoadNonVisible() {
195 expect(
196 [ // events
197 { label: "a-onBeforeRequest",
198 event: "onBeforeRequest",
199 details: {
200 url: getURL("simpleLoad/a.html"),
201 frameUrl: getURL("simpleLoad/a.html")
202 }
203 },
204 { label: "a-onResponseStarted",
205 event: "onResponseStarted",
206 details: {
207 url: getURL("simpleLoad/a.html"),
208 statusCode: 200,
209 fromCache: false,
210 statusLine: "HTTP/1.1 200 OK",
211 // Request to chrome-extension:// url has no IP.
212 }
213 },
214 { label: "a-onCompleted",
215 event: "onCompleted",
216 details: {
217 url: getURL("simpleLoad/a.html"),
218 statusCode: 200,
219 fromCache: false,
220 statusLine: "HTTP/1.1 200 OK",
221 // Request to chrome-extension:// url has no IP.
222 }
223 },
224 ],
225 [ // event order
226 ["a-onBeforeRequest", "a-onResponseStarted", "a-onCompleted"] ]);
227 navigateAndWait(getURLNotVisible(), function() {
228 navigateAndWait(getURL("simpleLoad/a.html"));
229 });
230 },
231 ]); 185 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698