| 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 #ifndef GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ | 5 #ifndef GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ |
| 6 #define GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ | 6 #define GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "google_apis/gcm/engine/connection_factory.h" | 9 #include "google_apis/gcm/engine/connection_factory.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // ConnectionFactory implementation. | 22 // ConnectionFactory implementation. |
| 23 virtual void Initialize( | 23 virtual void Initialize( |
| 24 const BuildLoginRequestCallback& request_builder, | 24 const BuildLoginRequestCallback& request_builder, |
| 25 const ConnectionHandler::ProtoReceivedCallback& read_callback, | 25 const ConnectionHandler::ProtoReceivedCallback& read_callback, |
| 26 const ConnectionHandler::ProtoSentCallback& write_callback) OVERRIDE; | 26 const ConnectionHandler::ProtoSentCallback& write_callback) OVERRIDE; |
| 27 virtual ConnectionHandler* GetConnectionHandler() const OVERRIDE; | 27 virtual ConnectionHandler* GetConnectionHandler() const OVERRIDE; |
| 28 virtual void Connect() OVERRIDE; | 28 virtual void Connect() OVERRIDE; |
| 29 virtual bool IsEndpointReachable() const OVERRIDE; | 29 virtual bool IsEndpointReachable() const OVERRIDE; |
| 30 virtual base::TimeTicks NextRetryAttempt() const OVERRIDE; | 30 virtual base::TimeTicks NextRetryAttempt() const OVERRIDE; |
| 31 virtual void SignalConnectionReset() OVERRIDE; | 31 virtual void SignalConnectionReset(ConnectionResetReason reason) OVERRIDE; |
| 32 |
| 33 // Whether a connection reset has been triggered and is yet to run. |
| 34 bool reconnect_pending() const { return reconnect_pending_; } |
| 35 |
| 36 // Whether connection resets should be handled immediately or delayed until |
| 37 // release. |
| 38 void set_delay_reconnect(bool should_delay) { |
| 39 delay_reconnect_ = should_delay; |
| 40 } |
| 32 | 41 |
| 33 private: | 42 private: |
| 34 scoped_ptr<FakeConnectionHandler> connection_handler_; | 43 scoped_ptr<FakeConnectionHandler> connection_handler_; |
| 35 | 44 |
| 36 BuildLoginRequestCallback request_builder_; | 45 BuildLoginRequestCallback request_builder_; |
| 37 | 46 |
| 47 // Logic for handling connection resets. |
| 48 bool reconnect_pending_; |
| 49 bool delay_reconnect_; |
| 50 |
| 38 DISALLOW_COPY_AND_ASSIGN(FakeConnectionFactory); | 51 DISALLOW_COPY_AND_ASSIGN(FakeConnectionFactory); |
| 39 }; | 52 }; |
| 40 | 53 |
| 41 } // namespace gcm | 54 } // namespace gcm |
| 42 | 55 |
| 43 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ | 56 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ |
| OLD | NEW |