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

Unified Diff: chrome/test/data/extensions/api_test/webrequest/test_blocking.html

Issue 7606010: Revert r96075 Split ExtensionWebRequestApiTest.WebRequestEvents into multiple (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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_blocking.html
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html b/chrome/test/data/extensions/api_test/webrequest/test_blocking.html
deleted file mode 100644
index 301a1a7c603cdc1313dbc767dd73823de5fe4d53..0000000000000000000000000000000000000000
--- a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html
+++ /dev/null
@@ -1,179 +0,0 @@
-<script src="framework.js">
-</script>
-<script>
-// Constants as functions, not to be called until after runTests.
-function getURLEchoUserAgent() {
- return getServerURL('echoheader?User-Agent');
-}
-
-runTests([
- // Navigates to a page with subresources, with a blocking handler that
- // cancels the page request. The page will not load, and we should not
- // see the subresources.
- function complexLoadCancelled() {
- expect(
- [ // events
- { label: "onBeforeRequest",
- event: "onBeforeRequest",
- details: {
- method: "GET",
- tabId: tabId,
- type: "main_frame",
- url: getURL("complexLoad/a.html"),
- frameUrl: getURL("complexLoad/a.html")
- },
- retval: {cancel: true}
- },
- // Cancelling is considered an error.
- { label: "onErrorOccurred",
- event: "onErrorOccurred",
- details: {
- url: getURL("complexLoad/a.html"),
- fromCache: false,
- error: "net::ERR_EMPTY_RESPONSE"
- // Request to chrome-extension:// url has no IP.
- }
- },
- ],
- [ // event order
- ["onBeforeRequest"]
- ],
- {}, // filter
- ["blocking"]);
- navigateAndWait(getURL("complexLoad/a.html"));
- },
-
- // Navigates to a page with a blocking handler that redirects to a different
- // page.
- // TODO(mpcomplete): We should see an onBeforeRedirect as well, but our
- // process switching logic cancels the original redirect request and
- // starts a new one instead. See http://crbug.com/79520.
- function complexLoadRedirected() {
- expect(
- [ // events
- { label: "onBeforeRequest-1",
- event: "onBeforeRequest",
- details: {
- method: "GET",
- tabId: tabId,
- type: "main_frame",
- url: getURL("complexLoad/a.html"),
- frameUrl: getURL("complexLoad/a.html")
- },
- retval: {redirectUrl: getURL("simpleLoad/a.html")}
- },
- { label: "onErrorOccurred-1",
- event: "onErrorOccurred",
- details: {
- url: getURL("complexLoad/a.html"),
- fromCache: false,
- error: "net::ERR_ABORTED"
- // Request to chrome-extension:// url has no IP.
- }
- },
- { label: "onBeforeRequest-2",
- event: "onBeforeRequest",
- details: {
- method: "GET",
- tabId: tabId,
- type: "main_frame",
- url: getURL("simpleLoad/a.html"),
- frameUrl: getURL("simpleLoad/a.html"),
- },
- },
- { label: "onResponseStarted",
- event: "onResponseStarted",
- details: {
- url: getURL("simpleLoad/a.html"),
- fromCache: false,
- statusCode: 200
- // Request to chrome-extension:// url has no IP.
- }
- },
- { label: "onCompleted",
- event: "onCompleted",
- details: {
- url: getURL("simpleLoad/a.html"),
- fromCache: false,
- statusCode: 200
- // Request to chrome-extension:// url has no IP.
- }
- },
- ],
- [ // event order
- ["onBeforeRequest-1", "onErrorOccurred-1", "onBeforeRequest-2",
- "onResponseStarted", "onCompleted"],
- ],
- {}, // filter
- ["blocking"]);
- navigateAndWait(getURL("complexLoad/a.html"));
- },
-
- // Loads a testserver page that echoes the User-Agent header that was
- // sent to fetch it. We modify the outgoing User-Agent in
- // onBeforeSendHeaders, so we should see that modified version.
- function modifyRequestHeaders() {
- expect(
- [ // events
- { label: "onBeforeRequest",
- event: "onBeforeRequest",
- details: {
- method: "GET",
- tabId: tabId,
- type: "main_frame",
- url: getURLEchoUserAgent(),
- frameUrl: getURLEchoUserAgent()
- }
- },
- { label: "onBeforeSendHeaders",
- event: "onBeforeSendHeaders",
- details: {
- url: getURLEchoUserAgent(),
- // Note: no requestHeaders because we don't ask for them.
- },
- retval: {requestHeaders: [{name: "User-Agent", value: "FoobarUA"}]}
- },
- { label: "onSendHeaders",
- event: "onSendHeaders",
- details: {
- url: getURLEchoUserAgent()
- }
- },
- { label: "onResponseStarted",
- event: "onResponseStarted",
- details: {
- url: getURLEchoUserAgent(),
- fromCache: false,
- statusCode: 200,
- ip: "127.0.0.1"
- }
- },
- { label: "onCompleted",
- event: "onCompleted",
- details: {
- url: getURLEchoUserAgent(),
- fromCache: false,
- statusCode: 200,
- ip: "127.0.0.1"
- }
- },
- ],
- [ // event order
- ["onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders",
- "onResponseStarted", "onCompleted"]
- ],
- {}, ["blocking"]);
- // Check the page content for our modified User-Agent string.
- navigateAndWait(getURLEchoUserAgent(), function() {
- chrome.test.listenOnce(chrome.extension.onRequest, function(request) {
- chrome.test.assertTrue(request.pass, "Request header was not set.");
- });
- chrome.tabs.executeScript(tabId,
- {
- code: "chrome.extension.sendRequest(" +
- "{pass: document.body.innerText.indexOf('FoobarUA') >= 0});"
- });
- });
- },
-]);
-</script>

Powered by Google App Engine
This is Rietveld 408576698