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

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

Issue 2238383003: webRequest: Also identify frames for non-RDH-initiated requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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_osdd.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_osdd.js b/chrome/test/data/extensions/api_test/webrequest/test_osdd.js
new file mode 100644
index 0000000000000000000000000000000000000000..d8c12f06ef211d97154aec97b92547fa44d2ed85
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webrequest/test_osdd.js
@@ -0,0 +1,89 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function getPageWithOSDDURL() {
+ // A document with path "/" linking to |getOSDDURL()|.
+ // OSDD are only loaded from "/".
Marijn Kruisselbrink 2016/08/15 22:02:15 Ah, is that why there is a ServeFilesFromDirectory
robwu 2016/08/17 08:44:32 Done.
+ return getServerURL('');
+}
+
+function getOSDDURL() {
+ // Referenced by |getPageWithOSDDURL()|, the response is not import
Marijn Kruisselbrink 2016/08/15 22:02:15 This comment seems to have been cut off? Also I g
robwu 2016/08/17 08:44:32 Done.
+ return getServerURL('opensearch-dont-ignore-me.xml');
+}
+
+
+runTests([
+ function test_linked_open_search_description() {
+ expect([
+ { label: 'onBeforeRequest',
+ event: 'onBeforeRequest',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ // Not getPageWithOSDDURL() because we are only listening to requests
+ // of type "other".
+ frameUrl: 'unknown frame URL',
+ tabId: 0,
+ }
+ },
+ { label: 'onBeforeSendHeaders',
+ event: 'onBeforeSendHeaders',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ tabId: 0,
+ },
+ },
+ { label: 'onSendHeaders',
+ event: 'onSendHeaders',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ tabId: 0,
+ },
+ },
+ { label: 'onHeadersReceived',
+ event: 'onHeadersReceived',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ tabId: 0,
+ statusLine: 'HTTP/1.1 404 Not Found',
+ statusCode: 404,
+ },
+ },
+ { label: 'onResponseStarted',
+ event: 'onResponseStarted',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ tabId: 0,
+ ip: '127.0.0.1',
+ fromCache: false,
+ statusLine: 'HTTP/1.1 404 Not Found',
+ statusCode: 404,
+ },
+ },
+ { label: 'onCompleted',
+ event: 'onCompleted',
+ details: {
+ type: 'other',
+ url: getOSDDURL(),
+ tabId: 0,
+ ip: '127.0.0.1',
+ fromCache: false,
+ statusLine: 'HTTP/1.1 404 Not Found',
+ statusCode: 404,
+ },
+ }],
+ [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
+ 'onHeadersReceived', 'onResponseStarted', 'onCompleted']],
+ {urls: ['<all_urls>'], types: ['other']});
+
+ navigateAndWait(getPageWithOSDDURL(), function() {
+ console.log('Navigated to ' + getPageWithOSDDURL());
+ });
+ },
+]);

Powered by Google App Engine
This is Rietveld 408576698