OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "google_apis/gcm/engine/connection_factory_impl.h" | 5 #include "google_apis/gcm/engine/connection_factory_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
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/run_loop.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 fake_handler_->set_fail_login(delay_login_); | 255 fake_handler_->set_fail_login(delay_login_); |
256 } | 256 } |
257 | 257 |
258 } // namespace | 258 } // namespace |
259 | 259 |
260 class ConnectionFactoryImplTest | 260 class ConnectionFactoryImplTest |
261 : public testing::Test, | 261 : public testing::Test, |
262 public ConnectionFactory::ConnectionListener { | 262 public ConnectionFactory::ConnectionListener { |
263 public: | 263 public: |
264 ConnectionFactoryImplTest(); | 264 ConnectionFactoryImplTest(); |
265 virtual ~ConnectionFactoryImplTest(); | 265 ~ConnectionFactoryImplTest() override; |
266 | 266 |
267 TestConnectionFactoryImpl* factory() { return &factory_; } | 267 TestConnectionFactoryImpl* factory() { return &factory_; } |
268 GURL& connected_server() { return connected_server_; } | 268 GURL& connected_server() { return connected_server_; } |
269 | 269 |
270 void WaitForConnections(); | 270 void WaitForConnections(); |
271 | 271 |
272 // ConnectionFactory::ConnectionListener | 272 // ConnectionFactory::ConnectionListener |
273 void OnConnected(const GURL& current_server, | 273 void OnConnected(const GURL& current_server, |
274 const net::IPEndPoint& ip_endpoint) override; | 274 const net::IPEndPoint& ip_endpoint) override; |
275 void OnDisconnected() override; | 275 void OnDisconnected() override; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // no effect. | 555 // no effect. |
556 TEST_F(ConnectionFactoryImplTest, NetworkChangeBeforeFirstConnection) { | 556 TEST_F(ConnectionFactoryImplTest, NetworkChangeBeforeFirstConnection) { |
557 factory()->OnNetworkChanged(net::NetworkChangeNotifier::CONNECTION_4G); | 557 factory()->OnNetworkChanged(net::NetworkChangeNotifier::CONNECTION_4G); |
558 factory()->SetConnectResult(net::OK); | 558 factory()->SetConnectResult(net::OK); |
559 factory()->Connect(); | 559 factory()->Connect(); |
560 EXPECT_TRUE(factory()->NextRetryAttempt().is_null()); | 560 EXPECT_TRUE(factory()->NextRetryAttempt().is_null()); |
561 EXPECT_TRUE(factory()->IsEndpointReachable()); | 561 EXPECT_TRUE(factory()->IsEndpointReachable()); |
562 } | 562 } |
563 | 563 |
564 } // namespace gcm | 564 } // namespace gcm |
OLD | NEW |