diff options
author | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 10:48:47 +0000 |
---|---|---|
committer | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 10:48:47 +0000 |
commit | 401ab8d7316610100a08d429ac5ee3be036fa80b (patch) | |
tree | 61625226db0755316df1d49f0a30e1772d913232 /chrome/test | |
parent | f07c43122d2bbd806b129a31f7808bb6a8784fbc (diff) | |
download | chromium_src-401ab8d7316610100a08d429ac5ee3be036fa80b.zip chromium_src-401ab8d7316610100a08d429ac5ee3be036fa80b.tar.gz chromium_src-401ab8d7316610100a08d429ac5ee3be036fa80b.tar.bz2 |
Adding condition attributes for request headers to Declarative WebRequest
TEST=Install the extension "declarative_request_headers_match.crx" attached to BUG 143662. If this feature is working correctly it should cancel every navigation.
BUG=143662, 112155
TBR=yoz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11038031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/data/extensions/api_test/webrequest/test_declarative.js | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_declarative.js b/chrome/test/data/extensions/api_test/webrequest/test_declarative.js index 9edb294..6d54189 100644 --- a/chrome/test/data/extensions/api_test/webrequest/test_declarative.js +++ b/chrome/test/data/extensions/api_test/webrequest/test_declarative.js @@ -185,7 +185,7 @@ runTests([ 'resourceType': ["main_frame"], 'contentType': ["text/plain"], 'excludeContentType': ["image/png"], - 'responseHeaders': [{ nameContains: ["content", "type"] } ], + 'responseHeaders': [{ nameContains: ["content", "type"] }], 'excludeResponseHeaders': [{ valueContains: "nonsense" }] })], 'actions': [new CancelRequest()]} ], @@ -619,4 +619,35 @@ runTests([ } ); }, + + function testRequestHeaders() { + ignoreUnexpected = true; + expect( + [ + { label: "onErrorOccurred", + event: "onErrorOccurred", + details: { + url: getURLHttpSimple(), + fromCache: false, + error: "net::ERR_BLOCKED_BY_CLIENT" + } + }, + ], + [ ["onErrorOccurred"] ]); + onRequest.addRules( + [ {'conditions': [ + new RequestMatcher({ + 'url': { + 'pathSuffix': ".html", + 'ports': [testServerPort, [1000, 2000]], + 'schemes': ["http"] + }, + 'requestHeaders': [{ nameContains: "" }], + 'excludeRequestHeaders': [{ valueContains: ["", "value123"] }] + })], + 'actions': [new CancelRequest()]} + ], + function() {navigateAndWait(getURLHttpSimple());} + ); + }, ]); |