| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 function getPageWithOSDDURL() { |
| 6 // A URL with path "/" (this points to webrequest/osdd/index.html). |
| 7 // The path is "/" because OSDD are only loaded from "/". |
| 8 return getServerURL(''); |
| 9 } |
| 10 |
| 11 function getOSDDURL() { |
| 12 // The URL of the OpenSearch description document that is referenced by the |
| 13 // page from |getPageWithOSDDURL()|. The actual response is not important, so |
| 14 // the server will reply with the default 404 handler. |
| 15 return getServerURL('opensearch-dont-ignore-me.xml'); |
| 16 } |
| 17 |
| 18 |
| 19 runTests([ |
| 20 function test_linked_open_search_description() { |
| 21 expect([ |
| 22 { label: 'onBeforeRequest', |
| 23 event: 'onBeforeRequest', |
| 24 details: { |
| 25 type: 'other', |
| 26 url: getOSDDURL(), |
| 27 // Not getPageWithOSDDURL() because we are only listening to requests |
| 28 // of type "other". |
| 29 frameUrl: 'unknown frame URL', |
| 30 tabId: 0, |
| 31 } |
| 32 }, |
| 33 { label: 'onBeforeSendHeaders', |
| 34 event: 'onBeforeSendHeaders', |
| 35 details: { |
| 36 type: 'other', |
| 37 url: getOSDDURL(), |
| 38 tabId: 0, |
| 39 }, |
| 40 }, |
| 41 { label: 'onSendHeaders', |
| 42 event: 'onSendHeaders', |
| 43 details: { |
| 44 type: 'other', |
| 45 url: getOSDDURL(), |
| 46 tabId: 0, |
| 47 }, |
| 48 }, |
| 49 { label: 'onHeadersReceived', |
| 50 event: 'onHeadersReceived', |
| 51 details: { |
| 52 type: 'other', |
| 53 url: getOSDDURL(), |
| 54 tabId: 0, |
| 55 statusLine: 'HTTP/1.1 404 Not Found', |
| 56 statusCode: 404, |
| 57 }, |
| 58 }, |
| 59 { label: 'onResponseStarted', |
| 60 event: 'onResponseStarted', |
| 61 details: { |
| 62 type: 'other', |
| 63 url: getOSDDURL(), |
| 64 tabId: 0, |
| 65 ip: '127.0.0.1', |
| 66 fromCache: false, |
| 67 statusLine: 'HTTP/1.1 404 Not Found', |
| 68 statusCode: 404, |
| 69 }, |
| 70 }, |
| 71 { label: 'onCompleted', |
| 72 event: 'onCompleted', |
| 73 details: { |
| 74 type: 'other', |
| 75 url: getOSDDURL(), |
| 76 tabId: 0, |
| 77 ip: '127.0.0.1', |
| 78 fromCache: false, |
| 79 statusLine: 'HTTP/1.1 404 Not Found', |
| 80 statusCode: 404, |
| 81 }, |
| 82 }], |
| 83 [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders', |
| 84 'onHeadersReceived', 'onResponseStarted', 'onCompleted']], |
| 85 {urls: ['<all_urls>'], types: ['other']}); |
| 86 |
| 87 // This page must be opened in the main frame, because OSDD requests are |
| 88 // only generated for main frame documents. |
| 89 navigateAndWait(getPageWithOSDDURL(), function() { |
| 90 console.log('Navigated to ' + getPageWithOSDDURL()); |
| 91 }); |
| 92 }, |
| 93 ]); |
| OLD | NEW |