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

Side by Side Diff: chrome/test/data/extensions/api_test/webrequest/test_declarative1.js

Issue 422233006: Add fake headers to URLRequestRedirectJobs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 var onRequest = chrome.declarativeWebRequest.onRequest; 5 var onRequest = chrome.declarativeWebRequest.onRequest;
6 var AddResponseHeader = 6 var AddResponseHeader =
7 chrome.declarativeWebRequest.AddResponseHeader; 7 chrome.declarativeWebRequest.AddResponseHeader;
8 var RequestMatcher = chrome.declarativeWebRequest.RequestMatcher; 8 var RequestMatcher = chrome.declarativeWebRequest.RequestMatcher;
9 var CancelRequest = chrome.declarativeWebRequest.CancelRequest; 9 var CancelRequest = chrome.declarativeWebRequest.CancelRequest;
10 var RedirectByRegEx = chrome.declarativeWebRequest.RedirectByRegEx; 10 var RedirectByRegEx = chrome.declarativeWebRequest.RedirectByRegEx;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 type: "main_frame", 303 type: "main_frame",
304 url: getURLHttpComplex(), 304 url: getURLHttpComplex(),
305 frameUrl: getURLHttpComplex() 305 frameUrl: getURLHttpComplex()
306 }, 306 },
307 }, 307 },
308 { label: "onBeforeRedirect", 308 { label: "onBeforeRedirect",
309 event: "onBeforeRedirect", 309 event: "onBeforeRedirect",
310 details: { 310 details: {
311 url: getURLHttpComplex(), 311 url: getURLHttpComplex(),
312 redirectUrl: getURLHttpSimple(), 312 redirectUrl: getURLHttpSimple(),
313 statusLine: "",
314 statusCode: -1,
315 fromCache: false, 313 fromCache: false,
314 statusLine: "HTTP/1.1 307 Internal Redirect",
315 statusCode: 307,
316 } 316 }
317 }, 317 },
318 { label: "onBeforeRequest-b", 318 { label: "onBeforeRequest-b",
319 event: "onBeforeRequest", 319 event: "onBeforeRequest",
320 details: { 320 details: {
321 type: "main_frame", 321 type: "main_frame",
322 url: getURLHttpSimple(), 322 url: getURLHttpSimple(),
323 frameUrl: getURLHttpSimple(), 323 frameUrl: getURLHttpSimple(),
324 }, 324 },
325 }, 325 },
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // for data:// URLs. 364 // for data:// URLs.
365 { label: "onBeforeRedirect-1", 365 { label: "onBeforeRedirect-1",
366 event: "onBeforeRedirect", 366 event: "onBeforeRedirect",
367 details: { 367 details: {
368 url: getServerURL( 368 url: getServerURL(
369 "extensions/api_test/webrequest/declarative/image.png"), 369 "extensions/api_test/webrequest/declarative/image.png"),
370 redirectUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA" + 370 redirectUrl: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA" +
371 "AAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJ" + 371 "AAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJ" +
372 "ggg==", 372 "ggg==",
373 fromCache: false, 373 fromCache: false,
374 statusCode: -1, 374 statusLine: "HTTP/1.1 307 Internal Redirect",
375 statusLine: "", 375 statusCode: 307,
376 type: "image", 376 type: "image",
377 } 377 }
378 }, 378 },
379 { label: "onBeforeRedirect-2", 379 { label: "onBeforeRedirect-2",
380 event: "onBeforeRedirect", 380 event: "onBeforeRedirect",
381 details: { 381 details: {
382 frameId: 1, 382 frameId: 1,
383 parentFrameId: 0, 383 parentFrameId: 0,
384 url: getServerURL( 384 url: getServerURL(
385 "extensions/api_test/webrequest/declarative/frame.html"), 385 "extensions/api_test/webrequest/declarative/frame.html"),
386 redirectUrl: "data:text/html,", 386 redirectUrl: "data:text/html,",
387 fromCache: false, 387 fromCache: false,
388 statusCode: -1, 388 statusLine: "HTTP/1.1 307 Internal Redirect",
389 statusLine: "", 389 statusCode: 307,
390 type: "sub_frame", 390 type: "sub_frame",
391 } 391 }
392 }, 392 },
393 ], 393 ],
394 [ ["onCompleted"], ["onBeforeRedirect-1"], ["onBeforeRedirect-2"] ]); 394 [ ["onCompleted"], ["onBeforeRedirect-1"], ["onBeforeRedirect-2"] ]);
395 395
396 onRequest.addRules( 396 onRequest.addRules(
397 [ {conditions: [ 397 [ {conditions: [
398 new RequestMatcher({url: {pathSuffix: "image.png"}})], 398 new RequestMatcher({url: {pathSuffix: "image.png"}})],
399 actions: [new RedirectToTransparentImage()]}, 399 actions: [new RedirectToTransparentImage()]},
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 'urlMatches': 'simple[A-Z].*a\.html$', 508 'urlMatches': 'simple[A-Z].*a\.html$',
509 'schemes': ["http"] 509 'schemes': ["http"]
510 }, 510 },
511 })], 511 })],
512 'actions': [new CancelRequest()]} 512 'actions': [new CancelRequest()]}
513 ], 513 ],
514 function() {navigateAndWait(getURLHttpSimple());} 514 function() {navigateAndWait(getURLHttpSimple());}
515 ); 515 );
516 }, 516 },
517 ]); 517 ]);
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/webrequest/test_blocking.js ('k') | net/base/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698