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/chrome_async_socket.h" | 5 #include "jingle/glue/chrome_async_socket.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 addr_("localhost", 35) { | 147 addr_("localhost", 35) { |
148 // GTest death tests execute in a fork()ed but not exec()ed process. | 148 // GTest death tests execute in a fork()ed but not exec()ed process. |
149 // On OS X a CoreFoundation-backed message loop will exit with a | 149 // On OS X a CoreFoundation-backed message loop will exit with a |
150 // __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONA
LITY___YOU_MUST_EXEC__ | 150 // __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONA
LITY___YOU_MUST_EXEC__ |
151 // when called. | 151 // when called. |
152 // Explicitly create a MessagePumpDefault which can run in this enivronment. | 152 // Explicitly create a MessagePumpDefault which can run in this enivronment. |
153 scoped_ptr<base::MessagePump> pump(new base::MessagePumpDefault()); | 153 scoped_ptr<base::MessagePump> pump(new base::MessagePumpDefault()); |
154 message_loop_.reset(new base::MessageLoop(pump.Pass())); | 154 message_loop_.reset(new base::MessageLoop(pump.Pass())); |
155 } | 155 } |
156 | 156 |
157 virtual ~ChromeAsyncSocketTest() {} | 157 ~ChromeAsyncSocketTest() override {} |
158 | 158 |
159 virtual void SetUp() { | 159 void SetUp() override { |
160 scoped_ptr<net::MockClientSocketFactory> mock_client_socket_factory( | 160 scoped_ptr<net::MockClientSocketFactory> mock_client_socket_factory( |
161 new net::MockClientSocketFactory()); | 161 new net::MockClientSocketFactory()); |
162 mock_client_socket_factory->AddSocketDataProvider( | 162 mock_client_socket_factory->AddSocketDataProvider( |
163 &async_socket_data_provider_); | 163 &async_socket_data_provider_); |
164 mock_client_socket_factory->AddSSLSocketDataProvider( | 164 mock_client_socket_factory->AddSSLSocketDataProvider( |
165 &ssl_socket_data_provider_); | 165 &ssl_socket_data_provider_); |
166 | 166 |
167 // Fake DNS resolution for |addr_| and pass it to the factory. | 167 // Fake DNS resolution for |addr_| and pass it to the factory. |
168 net::IPAddressNumber resolved_addr; | 168 net::IPAddressNumber resolved_addr; |
169 EXPECT_TRUE(net::ParseIPLiteralToNumber("127.0.0.1", &resolved_addr)); | 169 EXPECT_TRUE(net::ParseIPLiteralToNumber("127.0.0.1", &resolved_addr)); |
(...skipping 12 matching lines...) Expand all Loading... |
182 chrome_async_socket_->SignalSSLConnected.connect( | 182 chrome_async_socket_->SignalSSLConnected.connect( |
183 this, &ChromeAsyncSocketTest::OnSSLConnect); | 183 this, &ChromeAsyncSocketTest::OnSSLConnect); |
184 chrome_async_socket_->SignalClosed.connect( | 184 chrome_async_socket_->SignalClosed.connect( |
185 this, &ChromeAsyncSocketTest::OnClose); | 185 this, &ChromeAsyncSocketTest::OnClose); |
186 chrome_async_socket_->SignalRead.connect( | 186 chrome_async_socket_->SignalRead.connect( |
187 this, &ChromeAsyncSocketTest::OnRead); | 187 this, &ChromeAsyncSocketTest::OnRead); |
188 chrome_async_socket_->SignalError.connect( | 188 chrome_async_socket_->SignalError.connect( |
189 this, &ChromeAsyncSocketTest::OnError); | 189 this, &ChromeAsyncSocketTest::OnError); |
190 } | 190 } |
191 | 191 |
192 virtual void TearDown() { | 192 void TearDown() override { |
193 // Run any tasks that we forgot to pump. | 193 // Run any tasks that we forgot to pump. |
194 message_loop_->RunUntilIdle(); | 194 message_loop_->RunUntilIdle(); |
195 ExpectClosed(); | 195 ExpectClosed(); |
196 ExpectNoSignal(); | 196 ExpectNoSignal(); |
197 chrome_async_socket_.reset(); | 197 chrome_async_socket_.reset(); |
198 } | 198 } |
199 | 199 |
200 enum Signal { | 200 enum Signal { |
201 SIGNAL_CONNECT, | 201 SIGNAL_CONNECT, |
202 SIGNAL_SSL_CONNECT, | 202 SIGNAL_SSL_CONNECT, |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 message_loop_->RunUntilIdle(); | 1083 message_loop_->RunUntilIdle(); |
1084 | 1084 |
1085 ExpectNoSignal(); | 1085 ExpectNoSignal(); |
1086 | 1086 |
1087 DoSSLCloseOpenedNoError(); | 1087 DoSSLCloseOpenedNoError(); |
1088 } | 1088 } |
1089 | 1089 |
1090 } // namespace | 1090 } // namespace |
1091 | 1091 |
1092 } // namespace jingle_glue | 1092 } // namespace jingle_glue |
OLD | NEW |