| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/fake_connection_factory.h" | 5 #include "google_apis/gcm/engine/fake_connection_factory.h" |
| 6 | 6 |
| 7 #include "google_apis/gcm/engine/fake_connection_handler.h" | 7 #include "google_apis/gcm/engine/fake_connection_handler.h" |
| 8 #include "google_apis/gcm/protocol/mcs.pb.h" | 8 #include "google_apis/gcm/protocol/mcs.pb.h" |
| 9 #include "net/socket/stream_socket.h" | 9 #include "net/socket/stream_socket.h" |
| 10 | 10 |
| 11 namespace gcm { | 11 namespace gcm { |
| 12 | 12 |
| 13 FakeConnectionFactory::FakeConnectionFactory() { | 13 FakeConnectionFactory::FakeConnectionFactory() |
| 14 : reconnect_pending_(false), |
| 15 delay_reconnect_(false) { |
| 14 } | 16 } |
| 15 | 17 |
| 16 FakeConnectionFactory::~FakeConnectionFactory() { | 18 FakeConnectionFactory::~FakeConnectionFactory() { |
| 17 } | 19 } |
| 18 | 20 |
| 19 void FakeConnectionFactory::Initialize( | 21 void FakeConnectionFactory::Initialize( |
| 20 const BuildLoginRequestCallback& request_builder, | 22 const BuildLoginRequestCallback& request_builder, |
| 21 const ConnectionHandler::ProtoReceivedCallback& read_callback, | 23 const ConnectionHandler::ProtoReceivedCallback& read_callback, |
| 22 const ConnectionHandler::ProtoSentCallback& write_callback) { | 24 const ConnectionHandler::ProtoSentCallback& write_callback) { |
| 23 request_builder_ = request_builder; | 25 request_builder_ = request_builder; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 } | 38 } |
| 37 | 39 |
| 38 bool FakeConnectionFactory::IsEndpointReachable() const { | 40 bool FakeConnectionFactory::IsEndpointReachable() const { |
| 39 return connection_handler_.get() && connection_handler_->CanSendMessage(); | 41 return connection_handler_.get() && connection_handler_->CanSendMessage(); |
| 40 } | 42 } |
| 41 | 43 |
| 42 base::TimeTicks FakeConnectionFactory::NextRetryAttempt() const { | 44 base::TimeTicks FakeConnectionFactory::NextRetryAttempt() const { |
| 43 return base::TimeTicks(); | 45 return base::TimeTicks(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 void FakeConnectionFactory::SignalConnectionReset() { | 48 void FakeConnectionFactory::SignalConnectionReset( |
| 47 Connect(); | 49 ConnectionResetReason reason) { |
| 50 if (!delay_reconnect_) |
| 51 Connect(); |
| 52 else |
| 53 reconnect_pending_ = true; |
| 48 } | 54 } |
| 49 | 55 |
| 50 } // namespace gcm | 56 } // namespace gcm |
| OLD | NEW |