OLD | NEW |
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 #include "net/http/http_network_layer.h" | 5 #include "net/http/http_network_layer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
10 #include "net/cert/mock_cert_verifier.h" | 10 #include "net/cert/mock_cert_verifier.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ASSERT_EQ(proxy_count, retry_info.size()); | 101 ASSERT_EQ(proxy_count, retry_info.size()); |
102 if (proxy_count > 0) | 102 if (proxy_count > 0) |
103 ASSERT_TRUE(retry_info.find(bad_proxy) != retry_info.end()); | 103 ASSERT_TRUE(retry_info.find(bad_proxy) != retry_info.end()); |
104 if (proxy_count > 1) | 104 if (proxy_count > 1) |
105 ASSERT_TRUE(retry_info.find(bad_proxy2) != retry_info.end()); | 105 ASSERT_TRUE(retry_info.find(bad_proxy2) != retry_info.end()); |
106 } | 106 } |
107 | 107 |
108 // Simulates a request through a proxy which returns a bypass, which is then | 108 // Simulates a request through a proxy which returns a bypass, which is then |
109 // retried through a second proxy that doesn't bypass. | 109 // retried through a second proxy that doesn't bypass. |
110 // Checks that the expected requests were issued, the expected content was | 110 // Checks that the expected requests were issued, the expected content was |
111 // recieved, and the first proxy |bad_proxy| was marked as bad. | 111 // received, and the first proxy |bad_proxy| was marked as bad. |
112 void TestProxyFallback(const std::string& bad_proxy) { | 112 void TestProxyFallback(const std::string& bad_proxy) { |
113 MockRead data_reads[] = { | 113 MockRead data_reads[] = { |
114 MockRead("HTTP/1.1 200 OK\r\n" | 114 MockRead("HTTP/1.1 200 OK\r\n" |
115 "Chrome-Proxy: bypass=0\r\n\r\n"), | 115 "Chrome-Proxy: bypass=0\r\n\r\n"), |
116 MockRead("Bypass message"), | 116 MockRead("Bypass message"), |
117 MockRead(SYNCHRONOUS, OK), | 117 MockRead(SYNCHRONOUS, OK), |
118 }; | 118 }; |
119 TestProxyFallbackWithMockReads(bad_proxy, "", data_reads, | 119 TestProxyFallbackWithMockReads(bad_proxy, "", data_reads, |
120 arraysize(data_reads), 1u); | 120 arraysize(data_reads), 1u); |
121 } | 121 } |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 ASSERT_EQ(ERR_CONNECTION_RESET, callback.GetResult(rv)); | 825 ASSERT_EQ(ERR_CONNECTION_RESET, callback.GetResult(rv)); |
826 | 826 |
827 // If the response info is null, that means that any consumer won't | 827 // If the response info is null, that means that any consumer won't |
828 // see the network accessed bit set. | 828 // see the network accessed bit set. |
829 EXPECT_EQ(NULL, trans->GetResponseInfo()); | 829 EXPECT_EQ(NULL, trans->GetResponseInfo()); |
830 } | 830 } |
831 | 831 |
832 } // namespace | 832 } // namespace |
833 | 833 |
834 } // namespace net | 834 } // namespace net |
OLD | NEW |