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 function getURLHttpXHR() { | 5 function getURLHttpXHR() { |
6 return getServerURL('files/extensions/api_test/webrequest/xhr/a.html'); | 6 return getServerURL('extensions/api_test/webrequest/xhr/a.html'); |
7 } | 7 } |
8 function getURLHttpXHRJavaScript() { | 8 function getURLHttpXHRJavaScript() { |
9 return getServerURL('files/extensions/api_test/webrequest/xhr/a.js'); | 9 return getServerURL('extensions/api_test/webrequest/xhr/a.js'); |
10 } | 10 } |
11 function getURLHttpXHRData() { | 11 function getURLHttpXHRData() { |
12 return getServerURL('files/extensions/api_test/webrequest/xhr/data.json'); | 12 return getServerURL('extensions/api_test/webrequest/xhr/data.json'); |
13 } | 13 } |
14 | 14 |
15 runTests([ | 15 runTests([ |
16 // Navigates to a page with subresources. | 16 // Navigates to a page with subresources. |
17 function complexLoad() { | 17 function complexLoad() { |
18 expect( | 18 expect( |
19 [ // events | 19 [ // events |
20 { label: "a.html-onBeforeRequest", | 20 { label: "a.html-onBeforeRequest", |
21 event: "onBeforeRequest", | 21 event: "onBeforeRequest", |
22 details: { | 22 details: { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 details: { | 245 details: { |
246 type: "main_frame", | 246 type: "main_frame", |
247 url: getURLHttpXHR(), | 247 url: getURLHttpXHR(), |
248 } | 248 } |
249 }, | 249 }, |
250 { label: "onHeadersReceived-1", | 250 { label: "onHeadersReceived-1", |
251 event: "onHeadersReceived", | 251 event: "onHeadersReceived", |
252 details: { | 252 details: { |
253 type: "main_frame", | 253 type: "main_frame", |
254 url: getURLHttpXHR(), | 254 url: getURLHttpXHR(), |
255 statusLine: "HTTP/1.0 200 OK", | 255 statusLine: "HTTP/1.1 200 OK", |
256 } | 256 } |
257 }, | 257 }, |
258 { label: "onResponseStarted-1", | 258 { label: "onResponseStarted-1", |
259 event: "onResponseStarted", | 259 event: "onResponseStarted", |
260 details: { | 260 details: { |
261 type: "main_frame", | 261 type: "main_frame", |
262 url: getURLHttpXHR(), | 262 url: getURLHttpXHR(), |
263 statusCode: 200, | 263 statusCode: 200, |
264 ip: "127.0.0.1", | 264 ip: "127.0.0.1", |
265 fromCache: false, | 265 fromCache: false, |
266 statusLine: "HTTP/1.0 200 OK", | 266 statusLine: "HTTP/1.1 200 OK", |
267 } | 267 } |
268 }, | 268 }, |
269 { label: "onCompleted-1", | 269 { label: "onCompleted-1", |
270 event: "onCompleted", | 270 event: "onCompleted", |
271 details: { | 271 details: { |
272 type: "main_frame", | 272 type: "main_frame", |
273 url: getURLHttpXHR(), | 273 url: getURLHttpXHR(), |
274 statusCode: 200, | 274 statusCode: 200, |
275 ip: "127.0.0.1", | 275 ip: "127.0.0.1", |
276 fromCache: false, | 276 fromCache: false, |
277 statusLine: "HTTP/1.0 200 OK", | 277 statusLine: "HTTP/1.1 200 OK", |
278 } | 278 } |
279 }, | 279 }, |
280 { label: "a.js-onBeforeRequest", | 280 { label: "a.js-onBeforeRequest", |
281 event: "onBeforeRequest", | 281 event: "onBeforeRequest", |
282 details: { | 282 details: { |
283 type: "script", | 283 type: "script", |
284 url: getURLHttpXHRJavaScript(), | 284 url: getURLHttpXHRJavaScript(), |
285 frameUrl: getURLHttpXHR() | 285 frameUrl: getURLHttpXHR() |
286 } | 286 } |
287 }, | 287 }, |
288 { label: "a.js-onBeforeSendHeaders", | 288 { label: "a.js-onBeforeSendHeaders", |
289 event: "onBeforeSendHeaders", | 289 event: "onBeforeSendHeaders", |
290 details: { | 290 details: { |
291 type: "script", | 291 type: "script", |
292 url: getURLHttpXHRJavaScript(), | 292 url: getURLHttpXHRJavaScript(), |
293 } | 293 } |
294 }, | 294 }, |
295 { label: "a.js-onSendHeaders", | 295 { label: "a.js-onSendHeaders", |
296 event: "onSendHeaders", | 296 event: "onSendHeaders", |
297 details: { | 297 details: { |
298 type: "script", | 298 type: "script", |
299 url: getURLHttpXHRJavaScript(), | 299 url: getURLHttpXHRJavaScript(), |
300 } | 300 } |
301 }, | 301 }, |
302 { label: "a.js-onHeadersReceived", | 302 { label: "a.js-onHeadersReceived", |
303 event: "onHeadersReceived", | 303 event: "onHeadersReceived", |
304 details: { | 304 details: { |
305 type: "script", | 305 type: "script", |
306 url: getURLHttpXHRJavaScript(), | 306 url: getURLHttpXHRJavaScript(), |
307 statusLine: "HTTP/1.0 200 OK", | 307 statusLine: "HTTP/1.1 200 OK", |
308 } | 308 } |
309 }, | 309 }, |
310 { label: "a.js-onResponseStarted", | 310 { label: "a.js-onResponseStarted", |
311 event: "onResponseStarted", | 311 event: "onResponseStarted", |
312 details: { | 312 details: { |
313 type: "script", | 313 type: "script", |
314 url: getURLHttpXHRJavaScript(), | 314 url: getURLHttpXHRJavaScript(), |
315 statusCode: 200, | 315 statusCode: 200, |
316 ip: "127.0.0.1", | 316 ip: "127.0.0.1", |
317 fromCache: false, | 317 fromCache: false, |
318 statusLine: "HTTP/1.0 200 OK", | 318 statusLine: "HTTP/1.1 200 OK", |
319 } | 319 } |
320 }, | 320 }, |
321 { label: "a.js-onCompleted", | 321 { label: "a.js-onCompleted", |
322 event: "onCompleted", | 322 event: "onCompleted", |
323 details: { | 323 details: { |
324 type: "script", | 324 type: "script", |
325 url: getURLHttpXHRJavaScript(), | 325 url: getURLHttpXHRJavaScript(), |
326 statusCode: 200, | 326 statusCode: 200, |
327 ip: "127.0.0.1", | 327 ip: "127.0.0.1", |
328 fromCache: false, | 328 fromCache: false, |
329 statusLine: "HTTP/1.0 200 OK", | 329 statusLine: "HTTP/1.1 200 OK", |
330 } | 330 } |
331 }, | 331 }, |
332 { label: "onBeforeRequest-2", | 332 { label: "onBeforeRequest-2", |
333 event: "onBeforeRequest", | 333 event: "onBeforeRequest", |
334 details: { | 334 details: { |
335 type: "xmlhttprequest", | 335 type: "xmlhttprequest", |
336 url: getURLHttpXHRData(), | 336 url: getURLHttpXHRData(), |
337 frameUrl: getURLHttpXHR() | 337 frameUrl: getURLHttpXHR() |
338 } | 338 } |
339 }, | 339 }, |
340 { label: "onBeforeSendHeaders-2", | 340 { label: "onBeforeSendHeaders-2", |
341 event: "onBeforeSendHeaders", | 341 event: "onBeforeSendHeaders", |
342 details: { | 342 details: { |
343 type: "xmlhttprequest", | 343 type: "xmlhttprequest", |
344 url: getURLHttpXHRData(), | 344 url: getURLHttpXHRData(), |
345 } | 345 } |
346 }, | 346 }, |
347 { label: "onSendHeaders-2", | 347 { label: "onSendHeaders-2", |
348 event: "onSendHeaders", | 348 event: "onSendHeaders", |
349 details: { | 349 details: { |
350 type: "xmlhttprequest", | 350 type: "xmlhttprequest", |
351 url: getURLHttpXHRData(), | 351 url: getURLHttpXHRData(), |
352 } | 352 } |
353 }, | 353 }, |
354 { label: "onHeadersReceived-2", | 354 { label: "onHeadersReceived-2", |
355 event: "onHeadersReceived", | 355 event: "onHeadersReceived", |
356 details: { | 356 details: { |
357 type: "xmlhttprequest", | 357 type: "xmlhttprequest", |
358 url: getURLHttpXHRData(), | 358 url: getURLHttpXHRData(), |
359 statusLine: "HTTP/1.0 200 OK", | 359 statusLine: "HTTP/1.1 200 OK", |
360 } | 360 } |
361 }, | 361 }, |
362 { label: "onResponseStarted-2", | 362 { label: "onResponseStarted-2", |
363 event: "onResponseStarted", | 363 event: "onResponseStarted", |
364 details: { | 364 details: { |
365 type: "xmlhttprequest", | 365 type: "xmlhttprequest", |
366 url: getURLHttpXHRData(), | 366 url: getURLHttpXHRData(), |
367 statusCode: 200, | 367 statusCode: 200, |
368 ip: "127.0.0.1", | 368 ip: "127.0.0.1", |
369 fromCache: false, | 369 fromCache: false, |
370 statusLine: "HTTP/1.0 200 OK", | 370 statusLine: "HTTP/1.1 200 OK", |
371 } | 371 } |
372 }, | 372 }, |
373 { label: "onCompleted-2", | 373 { label: "onCompleted-2", |
374 event: "onCompleted", | 374 event: "onCompleted", |
375 details: { | 375 details: { |
376 type: "xmlhttprequest", | 376 type: "xmlhttprequest", |
377 url: getURLHttpXHRData(), | 377 url: getURLHttpXHRData(), |
378 statusCode: 200, | 378 statusCode: 200, |
379 ip: "127.0.0.1", | 379 ip: "127.0.0.1", |
380 fromCache: false, | 380 fromCache: false, |
381 statusLine: "HTTP/1.0 200 OK", | 381 statusLine: "HTTP/1.1 200 OK", |
382 } | 382 } |
383 } | 383 } |
384 ], | 384 ], |
385 [ // event order | 385 [ // event order |
386 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1", | 386 ["onBeforeRequest-1", "onBeforeSendHeaders-1", "onSendHeaders-1", |
387 "onHeadersReceived-1", "onResponseStarted-1", "onCompleted-1", | 387 "onHeadersReceived-1", "onResponseStarted-1", "onCompleted-1", |
388 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2", | 388 "onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2", |
389 "onHeadersReceived-2", "onResponseStarted-2", "onCompleted-2"] ]); | 389 "onHeadersReceived-2", "onResponseStarted-2", "onCompleted-2"] ]); |
390 navigateAndWait(getURLHttpXHR()); | 390 navigateAndWait(getURLHttpXHR()); |
391 }, | 391 }, |
392 ]); | 392 ]); |
OLD | NEW |