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 "jingle/glue/proxy_resolving_client_socket.h" | 5 #include "jingle/glue/proxy_resolving_client_socket.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 net::StaticSocketDataProvider socket_data1; | 77 net::StaticSocketDataProvider socket_data1; |
78 socket_data1.set_connect_data( | 78 socket_data1.set_connect_data( |
79 net::MockConnect(net::ASYNC, net::ERR_ADDRESS_UNREACHABLE)); | 79 net::MockConnect(net::ASYNC, net::ERR_ADDRESS_UNREACHABLE)); |
80 socket_factory.AddSocketDataProvider(&socket_data1); | 80 socket_factory.AddSocketDataProvider(&socket_data1); |
81 | 81 |
82 net::MockRead reads[] = { | 82 net::MockRead reads[] = { |
83 net::MockRead("HTTP/1.1 200 Success\r\n\r\n") | 83 net::MockRead("HTTP/1.1 200 Success\r\n\r\n") |
84 }; | 84 }; |
85 net::MockWrite writes[] = { | 85 net::MockWrite writes[] = { |
86 net::MockWrite("CONNECT example.com:443 HTTP/1.1\r\n" | 86 net::MockWrite("CONNECT example.com:443 HTTP/1.1\r\n" |
87 "Host: example.com:443\r\n" | 87 "Host: example.com\r\n" |
88 "Proxy-Connection: keep-alive\r\n\r\n") | 88 "Proxy-Connection: keep-alive\r\n\r\n") |
89 }; | 89 }; |
90 net::StaticSocketDataProvider socket_data2(reads, arraysize(reads), | 90 net::StaticSocketDataProvider socket_data2(reads, arraysize(reads), |
91 writes, arraysize(writes)); | 91 writes, arraysize(writes)); |
92 socket_data2.set_connect_data(net::MockConnect(net::ASYNC, net::OK)); | 92 socket_data2.set_connect_data(net::MockConnect(net::ASYNC, net::OK)); |
93 socket_factory.AddSocketDataProvider(&socket_data2); | 93 socket_factory.AddSocketDataProvider(&socket_data2); |
94 | 94 |
95 ProxyResolvingClientSocket proxy_resolving_socket( | 95 ProxyResolvingClientSocket proxy_resolving_socket( |
96 &socket_factory, | 96 &socket_factory, |
97 url_request_context_getter_, | 97 url_request_context_getter_, |
(...skipping 11 matching lines...) Expand all Loading... |
109 const net::ProxyRetryInfoMap& retry_info = | 109 const net::ProxyRetryInfoMap& retry_info = |
110 context->proxy_service()->proxy_retry_info(); | 110 context->proxy_service()->proxy_retry_info(); |
111 | 111 |
112 EXPECT_EQ(1u, retry_info.size()); | 112 EXPECT_EQ(1u, retry_info.size()); |
113 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); | 113 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); |
114 EXPECT_TRUE(iter != retry_info.end()); | 114 EXPECT_TRUE(iter != retry_info.end()); |
115 } | 115 } |
116 | 116 |
117 // TODO(sanjeevr): Add more unit-tests. | 117 // TODO(sanjeevr): Add more unit-tests. |
118 } // namespace jingle_glue | 118 } // namespace jingle_glue |
OLD | NEW |