OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Constants as functions, not to be called until after runTests. | 5 // Constants as functions, not to be called until after runTests. |
6 function getURLHttpSimpleLoad() { | 6 function getURLHttpSimpleLoad() { |
7 return getServerURL('files/extensions/api_test/webrequest/simpleLoad/a.html'); | 7 return getServerURL('extensions/api_test/webrequest/simpleLoad/a.html'); |
8 } | 8 } |
9 | 9 |
10 function getURLHttpSimpleLoadRedirect() { | 10 function getURLHttpSimpleLoadRedirect() { |
11 return getServerURL('server-redirect?'+getURLHttpSimpleLoad()); | 11 return getServerURL('server-redirect?'+getURLHttpSimpleLoad()); |
12 } | 12 } |
13 | 13 |
14 runTests([ | 14 runTests([ |
15 // Navigates to a blank page. | 15 // Navigates to a blank page. |
16 function simpleLoad() { | 16 function simpleLoad() { |
17 expect( | 17 expect( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 details: { | 73 details: { |
74 url: getURLHttpSimpleLoadRedirect(), | 74 url: getURLHttpSimpleLoadRedirect(), |
75 requestHeadersValid: true | 75 requestHeadersValid: true |
76 } | 76 } |
77 }, | 77 }, |
78 { label: "onHeadersReceived-1", | 78 { label: "onHeadersReceived-1", |
79 event: "onHeadersReceived", | 79 event: "onHeadersReceived", |
80 details: { | 80 details: { |
81 url: getURLHttpSimpleLoadRedirect(), | 81 url: getURLHttpSimpleLoadRedirect(), |
82 responseHeadersExist: true, | 82 responseHeadersExist: true, |
83 statusLine: "HTTP/1.0 301 Moved Permanently" | 83 statusLine: "HTTP/1.1 301 Moved Permanently" |
84 } | 84 } |
85 }, | 85 }, |
86 { label: "onBeforeRedirect", | 86 { label: "onBeforeRedirect", |
87 event: "onBeforeRedirect", | 87 event: "onBeforeRedirect", |
88 details: { | 88 details: { |
89 url: getURLHttpSimpleLoadRedirect(), | 89 url: getURLHttpSimpleLoadRedirect(), |
90 redirectUrl: getURLHttpSimpleLoad(), | 90 redirectUrl: getURLHttpSimpleLoad(), |
91 statusCode: 301, | 91 statusCode: 301, |
92 responseHeadersExist: true, | 92 responseHeadersExist: true, |
93 ip: "127.0.0.1", | 93 ip: "127.0.0.1", |
94 fromCache: false, | 94 fromCache: false, |
95 statusLine: "HTTP/1.0 301 Moved Permanently" | 95 statusLine: "HTTP/1.1 301 Moved Permanently" |
96 } | 96 } |
97 }, | 97 }, |
98 { label: "onBeforeRequest-2", | 98 { label: "onBeforeRequest-2", |
99 event: "onBeforeRequest", | 99 event: "onBeforeRequest", |
100 details: { | 100 details: { |
101 url: getURLHttpSimpleLoad(), | 101 url: getURLHttpSimpleLoad(), |
102 frameUrl: getURLHttpSimpleLoad() | 102 frameUrl: getURLHttpSimpleLoad() |
103 } | 103 } |
104 }, | 104 }, |
105 { label: "onBeforeSendHeaders-2", | 105 { label: "onBeforeSendHeaders-2", |
106 event: "onBeforeSendHeaders", | 106 event: "onBeforeSendHeaders", |
107 details: { | 107 details: { |
108 url: getURLHttpSimpleLoad(), | 108 url: getURLHttpSimpleLoad(), |
109 requestHeadersValid: true | 109 requestHeadersValid: true |
110 } | 110 } |
111 }, | 111 }, |
112 { label: "onSendHeaders-2", | 112 { label: "onSendHeaders-2", |
113 event: "onSendHeaders", | 113 event: "onSendHeaders", |
114 details: { | 114 details: { |
115 url: getURLHttpSimpleLoad(), | 115 url: getURLHttpSimpleLoad(), |
116 requestHeadersValid: true | 116 requestHeadersValid: true |
117 } | 117 } |
118 }, | 118 }, |
119 { label: "onHeadersReceived-2", | 119 { label: "onHeadersReceived-2", |
120 event: "onHeadersReceived", | 120 event: "onHeadersReceived", |
121 details: { | 121 details: { |
122 url: getURLHttpSimpleLoad(), | 122 url: getURLHttpSimpleLoad(), |
123 responseHeadersExist: true, | 123 responseHeadersExist: true, |
124 statusLine: "HTTP/1.0 200 OK", | 124 statusLine: "HTTP/1.1 200 OK", |
125 } | 125 } |
126 }, | 126 }, |
127 { label: "onResponseStarted", | 127 { label: "onResponseStarted", |
128 event: "onResponseStarted", | 128 event: "onResponseStarted", |
129 details: { | 129 details: { |
130 url: getURLHttpSimpleLoad(), | 130 url: getURLHttpSimpleLoad(), |
131 statusCode: 200, | 131 statusCode: 200, |
132 responseHeadersExist: true, | 132 responseHeadersExist: true, |
133 ip: "127.0.0.1", | 133 ip: "127.0.0.1", |
134 fromCache: false, | 134 fromCache: false, |
135 statusLine: "HTTP/1.0 200 OK", | 135 statusLine: "HTTP/1.1 200 OK", |
136 } | 136 } |
137 }, | 137 }, |
138 { label: "onCompleted", | 138 { label: "onCompleted", |
139 event: "onCompleted", | 139 event: "onCompleted", |
140 details: { | 140 details: { |
141 url: getURLHttpSimpleLoad(), | 141 url: getURLHttpSimpleLoad(), |
142 statusCode: 200, | 142 statusCode: 200, |
143 ip: "127.0.0.1", | 143 ip: "127.0.0.1", |
144 fromCache: false, | 144 fromCache: false, |
145 responseHeadersExist: true, | 145 responseHeadersExist: true, |
146 statusLine: "HTTP/1.0 200 OK" | 146 statusLine: "HTTP/1.1 200 OK" |
147 } | 147 } |
148 } | 148 } |
149 ], | 149 ], |
150 [ // event order | 150 [ // event order |
151 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1", | 151 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1", |
152 "onHeadersReceived-1", "onBeforeRedirect", | 152 "onHeadersReceived-1", "onBeforeRedirect", |
153 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2", | 153 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2", |
154 "onHeadersReceived-2", "onResponseStarted", "onCompleted"] ], | 154 "onHeadersReceived-2", "onResponseStarted", "onCompleted"] ], |
155 {urls: ["<all_urls>"]}, // filter | 155 {urls: ["<all_urls>"]}, // filter |
156 ["requestHeaders", "responseHeaders"]); | 156 ["requestHeaders", "responseHeaders"]); |
(...skipping 19 matching lines...) Expand all Loading... |
176 error: "net::ERR_FILE_NOT_FOUND", | 176 error: "net::ERR_FILE_NOT_FOUND", |
177 // Request to chrome-extension:// url has no IP. | 177 // Request to chrome-extension:// url has no IP. |
178 } | 178 } |
179 }, | 179 }, |
180 ], | 180 ], |
181 [ // event order | 181 [ // event order |
182 ["onBeforeRequest", "onErrorOccurred"] ]); | 182 ["onBeforeRequest", "onErrorOccurred"] ]); |
183 navigateAndWait(getURL("does_not_exist.html")); | 183 navigateAndWait(getURL("does_not_exist.html")); |
184 }, | 184 }, |
185 ]); | 185 ]); |
OLD | NEW |