| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
| 12 #include "net/dns/mock_host_resolver.h" | 13 #include "net/dns/mock_host_resolver.h" |
| 13 #include "net/proxy/proxy_service.h" | 14 #include "net/proxy/proxy_service.h" |
| 14 #include "net/socket/socket_test_util.h" | 15 #include "net/socket/socket_test_util.h" |
| 15 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 16 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 : url_request_context_getter_(new net::TestURLRequestContextGetter( | 40 : url_request_context_getter_(new net::TestURLRequestContextGetter( |
| 40 base::ThreadTaskRunnerHandle::Get(), | 41 base::ThreadTaskRunnerHandle::Get(), |
| 41 std::unique_ptr<net::TestURLRequestContext>( | 42 std::unique_ptr<net::TestURLRequestContext>( |
| 42 new MyTestURLRequestContext))) {} | 43 new MyTestURLRequestContext))) {} |
| 43 | 44 |
| 44 ~ProxyResolvingClientSocketTest() override {} | 45 ~ProxyResolvingClientSocketTest() override {} |
| 45 | 46 |
| 46 void TearDown() override { | 47 void TearDown() override { |
| 47 // Clear out any messages posted by ProxyResolvingClientSocket's | 48 // Clear out any messages posted by ProxyResolvingClientSocket's |
| 48 // destructor. | 49 // destructor. |
| 49 message_loop_.RunUntilIdle(); | 50 base::RunLoop().RunUntilIdle(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 base::MessageLoop message_loop_; | 53 base::MessageLoop message_loop_; |
| 53 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; | 54 scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // TODO(sanjeevr): Fix this test on Linux. | 57 // TODO(sanjeevr): Fix this test on Linux. |
| 57 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) { | 58 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) { |
| 58 net::HostPortPair dest("0.0.0.0", 0); | 59 net::HostPortPair dest("0.0.0.0", 0); |
| 59 ProxyResolvingClientSocket proxy_resolving_socket( | 60 ProxyResolvingClientSocket proxy_resolving_socket( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const net::ProxyRetryInfoMap& retry_info = | 111 const net::ProxyRetryInfoMap& retry_info = |
| 111 context->proxy_service()->proxy_retry_info(); | 112 context->proxy_service()->proxy_retry_info(); |
| 112 | 113 |
| 113 EXPECT_EQ(1u, retry_info.size()); | 114 EXPECT_EQ(1u, retry_info.size()); |
| 114 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); | 115 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); |
| 115 EXPECT_TRUE(iter != retry_info.end()); | 116 EXPECT_TRUE(iter != retry_info.end()); |
| 116 } | 117 } |
| 117 | 118 |
| 118 // TODO(sanjeevr): Add more unit-tests. | 119 // TODO(sanjeevr): Add more unit-tests. |
| 119 } // namespace jingle_glue | 120 } // namespace jingle_glue |
| OLD | NEW |