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