Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: jingle/notifier/base/proxy_resolving_client_socket_unittest.cc

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « jingle/notifier/base/proxy_resolving_client_socket.cc ('k') | net/base/net_log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/notifier/base/proxy_resolving_client_socket.h" 5 #include "jingle/notifier/base/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "net/base/mock_host_resolver.h" 9 #include "net/base/mock_host_resolver.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 }; 67 };
68 68
69 // TODO(sanjeevr): Fix this test on Linux. 69 // TODO(sanjeevr): Fix this test on Linux.
70 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) { 70 TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) {
71 net::HostPortPair dest("0.0.0.0", 0); 71 net::HostPortPair dest("0.0.0.0", 0);
72 ProxyResolvingClientSocket proxy_resolving_socket( 72 ProxyResolvingClientSocket proxy_resolving_socket(
73 NULL, 73 NULL,
74 url_request_context_getter_, 74 url_request_context_getter_,
75 net::SSLConfig(), 75 net::SSLConfig(),
76 dest); 76 dest);
77 TestOldCompletionCallback callback; 77 net::TestCompletionCallback callback;
78 int status = proxy_resolving_socket.Connect(&callback); 78 int status = proxy_resolving_socket.Connect(callback.callback());
79 // Connect always returns ERR_IO_PENDING because it is always asynchronous. 79 // Connect always returns ERR_IO_PENDING because it is always asynchronous.
80 EXPECT_EQ(net::ERR_IO_PENDING, status); 80 EXPECT_EQ(net::ERR_IO_PENDING, status);
81 status = callback.WaitForResult(); 81 status = callback.WaitForResult();
82 // ProxyResolvingClientSocket::Connect() will always return an error of 82 // ProxyResolvingClientSocket::Connect() will always return an error of
83 // ERR_ADDRESS_INVALID for a 0 IP address. 83 // ERR_ADDRESS_INVALID for a 0 IP address.
84 EXPECT_EQ(net::ERR_ADDRESS_INVALID, status); 84 EXPECT_EQ(net::ERR_ADDRESS_INVALID, status);
85 } 85 }
86 86
87 TEST_F(ProxyResolvingClientSocketTest, ReportsBadProxies) { 87 TEST_F(ProxyResolvingClientSocketTest, ReportsBadProxies) {
88 net::HostPortPair dest("example.com", 443); 88 net::HostPortPair dest("example.com", 443);
(...skipping 16 matching lines...) Expand all
105 writes, arraysize(writes)); 105 writes, arraysize(writes));
106 socket_data2.set_connect_data(net::MockConnect(true, net::OK)); 106 socket_data2.set_connect_data(net::MockConnect(true, net::OK));
107 socket_factory.AddSocketDataProvider(&socket_data2); 107 socket_factory.AddSocketDataProvider(&socket_data2);
108 108
109 ProxyResolvingClientSocket proxy_resolving_socket( 109 ProxyResolvingClientSocket proxy_resolving_socket(
110 &socket_factory, 110 &socket_factory,
111 url_request_context_getter_, 111 url_request_context_getter_,
112 net::SSLConfig(), 112 net::SSLConfig(),
113 dest); 113 dest);
114 114
115 TestOldCompletionCallback callback; 115 net::TestCompletionCallback callback;
116 int status = proxy_resolving_socket.Connect(&callback); 116 int status = proxy_resolving_socket.Connect(callback.callback());
117 EXPECT_EQ(net::ERR_IO_PENDING, status); 117 EXPECT_EQ(net::ERR_IO_PENDING, status);
118 status = callback.WaitForResult(); 118 status = callback.WaitForResult();
119 EXPECT_EQ(net::OK, status); 119 EXPECT_EQ(net::OK, status);
120 120
121 net::URLRequestContext* context = 121 net::URLRequestContext* context =
122 url_request_context_getter_->GetURLRequestContext(); 122 url_request_context_getter_->GetURLRequestContext();
123 const net::ProxyRetryInfoMap& retry_info = 123 const net::ProxyRetryInfoMap& retry_info =
124 context->proxy_service()->proxy_retry_info(); 124 context->proxy_service()->proxy_retry_info();
125 125
126 EXPECT_EQ(1u, retry_info.size()); 126 EXPECT_EQ(1u, retry_info.size());
127 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); 127 net::ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99");
128 EXPECT_TRUE(iter != retry_info.end()); 128 EXPECT_TRUE(iter != retry_info.end());
129 } 129 }
130 130
131 // TODO(sanjeevr): Add more unit-tests. 131 // TODO(sanjeevr): Add more unit-tests.
132 } // namespace notifier 132 } // namespace notifier
OLDNEW
« no previous file with comments | « jingle/notifier/base/proxy_resolving_client_socket.cc ('k') | net/base/net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698