OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.
h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 | 52 |
53 namespace data_reduction_proxy { | 53 namespace data_reduction_proxy { |
54 | 54 |
55 // A test network delegate that exercises the bypass logic of the data | 55 // A test network delegate that exercises the bypass logic of the data |
56 // reduction proxy. | 56 // reduction proxy. |
57 class TestDataReductionProxyNetworkDelegate : public net::NetworkDelegate { | 57 class TestDataReductionProxyNetworkDelegate : public net::NetworkDelegate { |
58 public: | 58 public: |
59 TestDataReductionProxyNetworkDelegate( | 59 TestDataReductionProxyNetworkDelegate( |
60 TestDataReductionProxyParams* test_params) | 60 TestDataReductionProxyParams* test_params, |
61 : net::NetworkDelegate(), test_data_reduction_proxy_params_(test_params) { | 61 ProxyService::DataReductionProxyBypassType* bypass_type) |
| 62 : net::NetworkDelegate(), |
| 63 test_data_reduction_proxy_params_(test_params), |
| 64 bypass_type_(bypass_type) { |
62 } | 65 } |
63 | 66 |
64 virtual int OnHeadersReceived( | 67 virtual int OnHeadersReceived( |
65 URLRequest* request, | 68 URLRequest* request, |
66 const net::CompletionCallback& callback, | 69 const net::CompletionCallback& callback, |
67 const HttpResponseHeaders* original_response_headers, | 70 const HttpResponseHeaders* original_response_headers, |
68 scoped_refptr<HttpResponseHeaders>* override_response_headers, | 71 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
69 GURL* allowed_unsafe_redirect_url) OVERRIDE { | 72 GURL* allowed_unsafe_redirect_url) OVERRIDE { |
70 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( | 73 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( |
71 test_data_reduction_proxy_params_, | 74 test_data_reduction_proxy_params_, |
72 request, | 75 request, |
73 original_response_headers, | 76 original_response_headers, |
74 override_response_headers); | 77 override_response_headers, |
| 78 bypass_type_); |
75 return net::OK; | 79 return net::OK; |
76 } | 80 } |
77 | 81 |
78 TestDataReductionProxyParams* test_data_reduction_proxy_params_; | 82 TestDataReductionProxyParams* test_data_reduction_proxy_params_; |
| 83 ProxyService::DataReductionProxyBypassType* bypass_type_; |
79 }; | 84 }; |
80 | 85 |
81 // Constructs a |TestURLRequestContext| that uses a |MockSocketFactory| to | 86 // Constructs a |TestURLRequestContext| that uses a |MockSocketFactory| to |
82 // simulate requests and responses. | 87 // simulate requests and responses. |
83 class DataReductionProxyProtocolTest : public testing::Test { | 88 class DataReductionProxyProtocolTest : public testing::Test { |
84 public: | 89 public: |
85 DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") { | 90 DataReductionProxyProtocolTest() : http_user_agent_settings_("", "") { |
86 proxy_params_.reset( | 91 proxy_params_.reset( |
87 new TestDataReductionProxyParams( | 92 new TestDataReductionProxyParams( |
88 DataReductionProxyParams::kAllowed | | 93 DataReductionProxyParams::kAllowed | |
89 DataReductionProxyParams::kFallbackAllowed | | 94 DataReductionProxyParams::kFallbackAllowed | |
90 DataReductionProxyParams::kPromoAllowed, | 95 DataReductionProxyParams::kPromoAllowed, |
91 TestDataReductionProxyParams::HAS_EVERYTHING & | 96 TestDataReductionProxyParams::HAS_EVERYTHING & |
92 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN)); | 97 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN)); |
93 } | 98 } |
94 | 99 |
95 // Sets up the |TestURLRequestContext| with the provided |ProxyService|. | 100 // Sets up the |TestURLRequestContext| with the provided |ProxyService| and |
96 void ConfigureTestDependencies(ProxyService* proxy_service) { | 101 // |bypass_type| to store bypass reasons. |
| 102 void ConfigureTestDependencies( |
| 103 ProxyService* proxy_service, |
| 104 ProxyService::DataReductionProxyBypassType* bypass_type) { |
97 // Create a context with delayed initialization. | 105 // Create a context with delayed initialization. |
98 context_.reset(new TestURLRequestContext(true)); | 106 context_.reset(new TestURLRequestContext(true)); |
99 | 107 |
100 proxy_service_.reset(proxy_service); | 108 proxy_service_.reset(proxy_service); |
101 network_delegate_.reset(new TestDataReductionProxyNetworkDelegate( | 109 network_delegate_.reset(new TestDataReductionProxyNetworkDelegate( |
102 proxy_params_.get())); | 110 proxy_params_.get(), bypass_type)); |
103 | 111 |
104 context_->set_client_socket_factory(&mock_socket_factory_); | 112 context_->set_client_socket_factory(&mock_socket_factory_); |
105 context_->set_proxy_service(proxy_service_.get()); | 113 context_->set_proxy_service(proxy_service_.get()); |
106 context_->set_network_delegate(network_delegate_.get()); | 114 context_->set_network_delegate(network_delegate_.get()); |
107 // This is needed to prevent the test context from adding language headers | 115 // This is needed to prevent the test context from adding language headers |
108 // to requests. | 116 // to requests. |
109 context_->set_http_user_agent_settings(&http_user_agent_settings_); | 117 context_->set_http_user_agent_settings(&http_user_agent_settings_); |
110 | 118 |
111 context_->Init(); | 119 context_->Init(); |
112 } | 120 } |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // was indicated. In both the single and double bypass cases, if the request | 360 // was indicated. In both the single and double bypass cases, if the request |
353 // was idempotent, it will be retried over a direct connection. | 361 // was idempotent, it will be retried over a direct connection. |
354 TEST_F(DataReductionProxyProtocolTest, BypassLogic) { | 362 TEST_F(DataReductionProxyProtocolTest, BypassLogic) { |
355 const struct { | 363 const struct { |
356 const char* method; | 364 const char* method; |
357 const char* first_response; | 365 const char* first_response; |
358 bool expected_retry; | 366 bool expected_retry; |
359 size_t expected_bad_proxy_count; | 367 size_t expected_bad_proxy_count; |
360 bool expect_response_body; | 368 bool expect_response_body; |
361 int expected_duration; | 369 int expected_duration; |
| 370 ProxyService::DataReductionProxyBypassType expected_bypass_type; |
362 } tests[] = { | 371 } tests[] = { |
363 // Valid data reduction proxy response with no bypass message. | 372 // Valid data reduction proxy response with no bypass message. |
364 { "GET", | 373 { "GET", |
365 "HTTP/1.1 200 OK\r\n" | 374 "HTTP/1.1 200 OK\r\n" |
366 "Server: proxy\r\n" | 375 "Server: proxy\r\n" |
367 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 376 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
368 false, | 377 false, |
369 0u, | 378 0u, |
370 true, | 379 true, |
371 -1 | 380 -1, |
| 381 ProxyService::BYPASS_EVENT_TYPE_MAX, |
372 }, | 382 }, |
373 // Valid data reduction proxy response with older, but still valid via | 383 // Valid data reduction proxy response with older, but still valid via |
374 // header. | 384 // header. |
375 { "GET", | 385 { "GET", |
376 "HTTP/1.1 200 OK\r\n" | 386 "HTTP/1.1 200 OK\r\n" |
377 "Server: proxy\r\n" | 387 "Server: proxy\r\n" |
378 "Via: 1.1 Chrome Compression Proxy\r\n\r\n", | 388 "Via: 1.1 Chrome Compression Proxy\r\n\r\n", |
379 false, | 389 false, |
380 0u, | 390 0u, |
381 true, | 391 true, |
382 -1 | 392 -1, |
| 393 ProxyService::BYPASS_EVENT_TYPE_MAX |
383 }, | 394 }, |
384 // Valid data reduction proxy response with chained via header, | 395 // Valid data reduction proxy response with chained via header, |
385 // no bypass message. | 396 // no bypass message. |
386 { "GET", | 397 { "GET", |
387 "HTTP/1.1 200 OK\r\n" | 398 "HTTP/1.1 200 OK\r\n" |
388 "Server: proxy\r\n" | 399 "Server: proxy\r\n" |
389 "Via: 1.1 Chrome-Compression-Proxy, 1.0 some-other-proxy\r\n\r\n", | 400 "Via: 1.1 Chrome-Compression-Proxy, 1.0 some-other-proxy\r\n\r\n", |
390 false, | 401 false, |
391 0u, | 402 0u, |
392 true, | 403 true, |
393 -1 | 404 -1, |
| 405 ProxyService::BYPASS_EVENT_TYPE_MAX |
394 }, | 406 }, |
395 // Valid data reduction proxy response with a bypass message. | 407 // Valid data reduction proxy response with a bypass message. |
396 { "GET", | 408 { "GET", |
397 "HTTP/1.1 200 OK\r\n" | 409 "HTTP/1.1 200 OK\r\n" |
398 "Server: proxy\r\n" | 410 "Server: proxy\r\n" |
399 "Chrome-Proxy: bypass=0\r\n" | 411 "Chrome-Proxy: bypass=0\r\n" |
400 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 412 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
401 true, | 413 true, |
402 1u, | 414 1u, |
403 true, | 415 true, |
404 0 | 416 0, |
| 417 ProxyService::MEDIUM_BYPASS |
405 }, | 418 }, |
406 // Valid data reduction proxy response with a bypass message. | 419 // Valid data reduction proxy response with a bypass message. |
407 { "GET", | 420 { "GET", |
408 "HTTP/1.1 200 OK\r\n" | 421 "HTTP/1.1 200 OK\r\n" |
409 "Server: proxy\r\n" | 422 "Server: proxy\r\n" |
410 "Chrome-Proxy: bypass=1\r\n" | 423 "Chrome-Proxy: bypass=1\r\n" |
411 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 424 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
412 true, | 425 true, |
413 1u, | 426 1u, |
414 true, | 427 true, |
415 1 | 428 1, |
| 429 ProxyService::SHORT_BYPASS |
416 }, | 430 }, |
417 // Same as above with the OPTIONS method, which is idempotent. | 431 // Same as above with the OPTIONS method, which is idempotent. |
418 { "OPTIONS", | 432 { "OPTIONS", |
419 "HTTP/1.1 200 OK\r\n" | 433 "HTTP/1.1 200 OK\r\n" |
420 "Server: proxy\r\n" | 434 "Server: proxy\r\n" |
421 "Chrome-Proxy: bypass=0\r\n" | 435 "Chrome-Proxy: bypass=0\r\n" |
422 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 436 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
423 true, | 437 true, |
424 1u, | 438 1u, |
425 true, | 439 true, |
426 0 | 440 0, |
| 441 ProxyService::MEDIUM_BYPASS |
427 }, | 442 }, |
428 // Same as above with the HEAD method, which is idempotent. | 443 // Same as above with the HEAD method, which is idempotent. |
429 { "HEAD", | 444 { "HEAD", |
430 "HTTP/1.1 200 OK\r\n" | 445 "HTTP/1.1 200 OK\r\n" |
431 "Server: proxy\r\n" | 446 "Server: proxy\r\n" |
432 "Chrome-Proxy: bypass=0\r\n" | 447 "Chrome-Proxy: bypass=0\r\n" |
433 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 448 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
434 true, | 449 true, |
435 1u, | 450 1u, |
436 false, | 451 false, |
437 0 | 452 0, |
| 453 ProxyService::MEDIUM_BYPASS |
438 }, | 454 }, |
439 // Same as above with the PUT method, which is idempotent. | 455 // Same as above with the PUT method, which is idempotent. |
440 { "PUT", | 456 { "PUT", |
441 "HTTP/1.1 200 OK\r\n" | 457 "HTTP/1.1 200 OK\r\n" |
442 "Server: proxy\r\n" | 458 "Server: proxy\r\n" |
443 "Chrome-Proxy: bypass=0\r\n" | 459 "Chrome-Proxy: bypass=0\r\n" |
444 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 460 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
445 true, | 461 true, |
446 1u, | 462 1u, |
447 true, | 463 true, |
448 0 | 464 0, |
| 465 ProxyService::MEDIUM_BYPASS |
449 }, | 466 }, |
450 // Same as above with the DELETE method, which is idempotent. | 467 // Same as above with the DELETE method, which is idempotent. |
451 { "DELETE", | 468 { "DELETE", |
452 "HTTP/1.1 200 OK\r\n" | 469 "HTTP/1.1 200 OK\r\n" |
453 "Server: proxy\r\n" | 470 "Server: proxy\r\n" |
454 "Chrome-Proxy: bypass=0\r\n" | 471 "Chrome-Proxy: bypass=0\r\n" |
455 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 472 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
456 true, | 473 true, |
457 1u, | 474 1u, |
458 true, | 475 true, |
459 0 | 476 0, |
| 477 ProxyService::MEDIUM_BYPASS |
460 }, | 478 }, |
461 // Same as above with the TRACE method, which is idempotent. | 479 // Same as above with the TRACE method, which is idempotent. |
462 { "TRACE", | 480 { "TRACE", |
463 "HTTP/1.1 200 OK\r\n" | 481 "HTTP/1.1 200 OK\r\n" |
464 "Server: proxy\r\n" | 482 "Server: proxy\r\n" |
465 "Chrome-Proxy: bypass=0\r\n" | 483 "Chrome-Proxy: bypass=0\r\n" |
466 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 484 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
467 true, | 485 true, |
468 1u, | 486 1u, |
469 true, | 487 true, |
470 0 | 488 0, |
| 489 ProxyService::MEDIUM_BYPASS |
471 }, | 490 }, |
472 // 500 responses should be bypassed. | 491 // 500 responses should be bypassed. |
473 { "GET", | 492 { "GET", |
474 "HTTP/1.1 500 Internal Server Error\r\n" | 493 "HTTP/1.1 500 Internal Server Error\r\n" |
475 "Server: proxy\r\n" | 494 "Server: proxy\r\n" |
476 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 495 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
477 true, | 496 true, |
478 1u, | 497 1u, |
479 true, | 498 true, |
480 0 | 499 0, |
| 500 ProxyService::STATUS_500_HTTP_INTERNAL_SERVER_ERROR |
481 }, | 501 }, |
482 // 502 responses should be bypassed. | 502 // 502 responses should be bypassed. |
483 { "GET", | 503 { "GET", |
484 "HTTP/1.1 502 Internal Server Error\r\n" | 504 "HTTP/1.1 502 Internal Server Error\r\n" |
485 "Server: proxy\r\n" | 505 "Server: proxy\r\n" |
486 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 506 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
487 true, | 507 true, |
488 1u, | 508 1u, |
489 true, | 509 true, |
490 0 | 510 0, |
| 511 ProxyService::STATUS_502_HTTP_BAD_GATEWAY |
491 }, | 512 }, |
492 // 503 responses should be bypassed. | 513 // 503 responses should be bypassed. |
493 { "GET", | 514 { "GET", |
494 "HTTP/1.1 503 Internal Server Error\r\n" | 515 "HTTP/1.1 503 Internal Server Error\r\n" |
495 "Server: proxy\r\n" | 516 "Server: proxy\r\n" |
496 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 517 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
497 true, | 518 true, |
498 1u, | 519 1u, |
499 true, | 520 true, |
500 0 | 521 0, |
| 522 ProxyService::STATUS_503_HTTP_SERVICE_UNAVAILABLE |
501 }, | 523 }, |
502 // Invalid data reduction proxy response. Missing Via header. | 524 // Invalid data reduction proxy response. Missing Via header. |
503 { "GET", | 525 { "GET", |
504 "HTTP/1.1 200 OK\r\n" | 526 "HTTP/1.1 200 OK\r\n" |
505 "Server: proxy\r\n\r\n", | 527 "Server: proxy\r\n\r\n", |
506 true, | 528 true, |
507 1u, | 529 1u, |
508 true, | 530 true, |
509 0 | 531 0, |
| 532 ProxyService::MISSING_VIA_HEADER_OTHER |
510 }, | 533 }, |
511 // Invalid data reduction proxy response. Wrong Via header. | 534 // Invalid data reduction proxy response. Wrong Via header. |
512 { "GET", | 535 { "GET", |
513 "HTTP/1.1 200 OK\r\n" | 536 "HTTP/1.1 200 OK\r\n" |
514 "Server: proxy\r\n" | 537 "Server: proxy\r\n" |
515 "Via: 1.0 some-other-proxy\r\n\r\n", | 538 "Via: 1.0 some-other-proxy\r\n\r\n", |
516 true, | 539 true, |
517 1u, | 540 1u, |
518 true, | 541 true, |
519 0 | 542 0, |
| 543 ProxyService::MISSING_VIA_HEADER_OTHER |
520 }, | 544 }, |
521 // Valid data reduction proxy response. 304 missing Via header. | 545 // Valid data reduction proxy response. 304 missing Via header. |
522 { "GET", | 546 { "GET", |
523 "HTTP/1.1 304 Not Modified\r\n" | 547 "HTTP/1.1 304 Not Modified\r\n" |
524 "Server: proxy\r\n\r\n", | 548 "Server: proxy\r\n\r\n", |
525 false, | 549 false, |
526 0u, | 550 0u, |
527 false, | 551 false, |
528 0 | 552 0, |
| 553 ProxyService::BYPASS_EVENT_TYPE_MAX |
529 }, | 554 }, |
530 // Valid data reduction proxy response with a bypass message. It will | 555 // Valid data reduction proxy response with a bypass message. It will |
531 // not be retried because the request is non-idempotent. | 556 // not be retried because the request is non-idempotent. |
532 { "POST", | 557 { "POST", |
533 "HTTP/1.1 200 OK\r\n" | 558 "HTTP/1.1 200 OK\r\n" |
534 "Server: proxy\r\n" | 559 "Server: proxy\r\n" |
535 "Chrome-Proxy: bypass=0\r\n" | 560 "Chrome-Proxy: bypass=0\r\n" |
536 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 561 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
537 false, | 562 false, |
538 1u, | 563 1u, |
539 true, | 564 true, |
540 0 | 565 0, |
| 566 ProxyService::MEDIUM_BYPASS |
541 }, | 567 }, |
542 // Valid data reduction proxy response with block message. Both proxies | 568 // Valid data reduction proxy response with block message. Both proxies |
543 // should be on the retry list when it completes. | 569 // should be on the retry list when it completes. |
544 { "GET", | 570 { "GET", |
545 "HTTP/1.1 200 OK\r\n" | 571 "HTTP/1.1 200 OK\r\n" |
546 "Server: proxy\r\n" | 572 "Server: proxy\r\n" |
547 "Chrome-Proxy: block=1\r\n" | 573 "Chrome-Proxy: block=1\r\n" |
548 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", | 574 "Via: 1.1 Chrome-Compression-Proxy\r\n\r\n", |
549 true, | 575 true, |
550 2u, | 576 2u, |
551 true, | 577 true, |
552 1 | 578 1, |
| 579 ProxyService::SHORT_BYPASS |
553 } | 580 } |
554 }; | 581 }; |
555 std::string primary = proxy_params_->DefaultOrigin(); | 582 std::string primary = proxy_params_->DefaultOrigin(); |
556 std::string fallback = proxy_params_->DefaultFallbackOrigin(); | 583 std::string fallback = proxy_params_->DefaultFallbackOrigin(); |
557 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 584 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 585 ProxyService::DataReductionProxyBypassType bypass_type; |
558 ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult( | 586 ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult( |
559 "PROXY " + | 587 "PROXY " + |
560 HostPortPair::FromURL(GURL(primary)).ToString() + "; PROXY " + | 588 HostPortPair::FromURL(GURL(primary)).ToString() + "; PROXY " + |
561 HostPortPair::FromURL(GURL(fallback)).ToString() + "; DIRECT")); | 589 HostPortPair::FromURL(GURL(fallback)).ToString() + "; DIRECT"), |
| 590 &bypass_type); |
562 TestProxyFallback(tests[i].method, | 591 TestProxyFallback(tests[i].method, |
563 tests[i].first_response, | 592 tests[i].first_response, |
564 tests[i].expected_retry, | 593 tests[i].expected_retry, |
565 tests[i].expect_response_body); | 594 tests[i].expect_response_body); |
566 | 595 |
| 596 EXPECT_EQ(tests[i].expected_bypass_type, bypass_type); |
| 597 |
567 // We should also observe the bad proxy in the retry list. | 598 // We should also observe the bad proxy in the retry list. |
568 TestBadProxies(tests[i].expected_bad_proxy_count, | 599 TestBadProxies(tests[i].expected_bad_proxy_count, |
569 tests[i].expected_duration, | 600 tests[i].expected_duration, |
570 primary, fallback); | 601 primary, fallback); |
571 } | 602 } |
572 } | 603 } |
573 | 604 |
574 TEST_F(DataReductionProxyProtocolTest, | 605 TEST_F(DataReductionProxyProtocolTest, |
575 ProxyBypassIgnoredOnDirectConnection) { | 606 ProxyBypassIgnoredOnDirectConnection) { |
576 // Verify that a Chrome-Proxy header is ignored when returned from a directly | 607 // Verify that a Chrome-Proxy header is ignored when returned from a directly |
577 // connected origin server. | 608 // connected origin server. |
578 ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult("DIRECT")); | 609 ConfigureTestDependencies(ProxyService::CreateFixedFromPacResult("DIRECT"), |
| 610 NULL); |
579 | 611 |
580 MockRead data_reads[] = { | 612 MockRead data_reads[] = { |
581 MockRead("HTTP/1.1 200 OK\r\n" | 613 MockRead("HTTP/1.1 200 OK\r\n" |
582 "Chrome-Proxy: bypass=0\r\n\r\n"), | 614 "Chrome-Proxy: bypass=0\r\n\r\n"), |
583 MockRead("Bypass message"), | 615 MockRead("Bypass message"), |
584 MockRead(net::SYNCHRONOUS, net::OK), | 616 MockRead(net::SYNCHRONOUS, net::OK), |
585 }; | 617 }; |
586 MockWrite data_writes[] = { | 618 MockWrite data_writes[] = { |
587 MockWrite("GET / HTTP/1.1\r\n" | 619 MockWrite("GET / HTTP/1.1\r\n" |
588 "Host: www.google.com\r\n" | 620 "Host: www.google.com\r\n" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; | 716 load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY; |
685 | 717 |
686 OnResolveProxyHandler(url, load_flags, &test_params, &info2); | 718 OnResolveProxyHandler(url, load_flags, &test_params, &info2); |
687 EXPECT_FALSE(info2.is_direct()); | 719 EXPECT_FALSE(info2.is_direct()); |
688 | 720 |
689 OnResolveProxyHandler(url, load_flags, &test_params, &info1); | 721 OnResolveProxyHandler(url, load_flags, &test_params, &info1); |
690 EXPECT_TRUE(info1.is_direct()); | 722 EXPECT_TRUE(info1.is_direct()); |
691 } | 723 } |
692 | 724 |
693 } // namespace data_reduction_proxy | 725 } // namespace data_reduction_proxy |
OLD | NEW |