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

Unified Diff: chrome/test/data/extensions/api_test/webrequest/test_declarative1.js

Issue 154473002: Support redirectUrl at onHeadersReceived in WebRequest / DWR API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix WebRequestRulesRegistrySimpleTest.StageChecker test Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/webrequest/test_declarative1.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js b/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js
index 8705ff9f2ca9edba3066ef14f1fcbe39495015f4..bdd46aa7a41d4b4f63dbaa06ee4c67a809f2c61d 100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js
+++ b/chrome/test/data/extensions/api_test/webrequest/test_declarative1.js
@@ -405,6 +405,62 @@ runTests([
);
},
+ // Tests that a request is redirected during the onHeadersReceived stage
+ // when the conditions include a RequestMatcher with a contentType.
+ function testRedirectRequestByContentType() {
+ ignoreUnexpected = true;
+ expect(
+ [
+ { label: "onBeforeRequest-a",
+ event: "onBeforeRequest",
+ details: {
+ type: "main_frame",
+ url: getURLHttpWithHeaders(),
+ frameUrl: getURLHttpWithHeaders()
+ },
+ },
+ { label: "onBeforeRedirect",
+ event: "onBeforeRedirect",
+ details: {
+ url: getURLHttpWithHeaders(),
+ redirectUrl: getURLHttpSimple(),
+ statusLine: "HTTP/1.1 302 Found",
+ statusCode: 302,
+ fromCache: false,
+ ip: "127.0.0.1",
+ }
+ },
+ { label: "onBeforeRequest-b",
+ event: "onBeforeRequest",
+ details: {
+ type: "main_frame",
+ url: getURLHttpSimple(),
+ frameUrl: getURLHttpSimple(),
+ },
+ },
+ { label: "onCompleted",
+ event: "onCompleted",
+ details: {
+ ip: "127.0.0.1",
+ url: getURLHttpSimple(),
+ fromCache: false,
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
+ }
+ },
+ ],
+ [ ["onBeforeRequest-a", "onBeforeRedirect", "onBeforeRequest-b",
+ "onCompleted"] ]);
+
+ onRequest.addRules(
+ [ {'conditions': [new RequestMatcher({'contentType': ["text/plain"]})],
+ 'actions': [
+ new RedirectRequest({'redirectUrl': getURLHttpSimple()})]}
+ ],
+ function() {navigateAndWait(getURLHttpWithHeaders());}
+ );
+ },
+
function testRedirectByRegEx() {
ignoreUnexpected = true;
expect(
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/test_blocking.js ('k') | content/shell/browser/shell_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698