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

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

Issue 10012004: Implemented proper support for checking schemes and requested resource types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed 'scheme' to 'schemes' Created 8 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
« no previous file with comments | « chrome/common/extensions/docs/experimental.webRequest.html ('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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 onRequest = chrome.experimental.webRequest.onRequest; 5 var onRequest = chrome.experimental.webRequest.onRequest;
6 var RequestMatcher = chrome.experimental.webRequest.RequestMatcher; 6 var RequestMatcher = chrome.experimental.webRequest.RequestMatcher;
7 var CancelRequest = chrome.experimental.webRequest.CancelRequest; 7 var CancelRequest = chrome.experimental.webRequest.CancelRequest;
8 var RedirectRequest = chrome.experimental.webRequest.RedirectRequest; 8 var RedirectRequest = chrome.experimental.webRequest.RedirectRequest;
9 9
10 runTests([ 10 runTests([
11 function testCancelRequest() { 11 function testCancelRequest() {
12 ignoreUnexpected = true; 12 ignoreUnexpected = true;
13 expect( 13 expect(
14 [ 14 [
15 { label: "onErrorOccurred", 15 { label: "onErrorOccurred",
16 event: "onErrorOccurred", 16 event: "onErrorOccurred",
17 details: { 17 details: {
18 url: getURL("simpleLoad/a.html"), 18 url: getURL("simpleLoad/a.html"),
19 fromCache: false, 19 fromCache: false,
20 error: "net::ERR_BLOCKED_BY_CLIENT" 20 error: "net::ERR_BLOCKED_BY_CLIENT"
21 } 21 }
22 }, 22 },
23 ], 23 ],
24 [ ["onCompleted"] ]); 24 [ ["onCompleted"] ]);
25 25
26 onRequest.addRules( 26 onRequest.addRules(
27 [ {'conditions': [new RequestMatcher({'path_suffix': ".html"})], 27 [ {'conditions': [
28 new RequestMatcher({'path_suffix': ".html",
29 'resourceType': ["main_frame"],
30 'schemes': ["chrome-extension"]})],
28 'actions': [new CancelRequest()]} 31 'actions': [new CancelRequest()]}
29 ], 32 ],
30 function() {navigateAndWait(getURL("simpleLoad/a.html"));} 33 function() {navigateAndWait(getURL("simpleLoad/a.html"));}
31 ); 34 );
32 }, 35 },
33 36
34 function testRedirectRequest() { 37 function testRedirectRequest() {
35 ignoreUnexpected = true; 38 ignoreUnexpected = true;
36 expect( 39 expect(
37 [ 40 [
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 "onCompleted"] ]); 78 "onCompleted"] ]);
76 79
77 onRequest.addRules( 80 onRequest.addRules(
78 [ {'conditions': [new RequestMatcher({'path_suffix': ".html"})], 81 [ {'conditions': [new RequestMatcher({'path_suffix': ".html"})],
79 'actions': [ 82 'actions': [
80 new RedirectRequest({'redirectUrl': getURL("simpleLoad/a.html")})]} 83 new RedirectRequest({'redirectUrl': getURL("simpleLoad/a.html")})]}
81 ], 84 ],
82 function() {navigateAndWait(getURL("complexLoad/a.html"));} 85 function() {navigateAndWait(getURL("complexLoad/a.html"));}
83 ); 86 );
84 }, 87 },
85 ]); 88 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/experimental.webRequest.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698