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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "google_apis/gcm/engine/connection_factory.h" | 11 #include "google_apis/gcm/engine/connection_factory.h" |
11 | 12 |
12 namespace gcm { | 13 namespace gcm { |
13 | 14 |
14 class FakeConnectionHandler; | 15 class FakeConnectionHandler; |
15 | 16 |
16 // A connection factory that mocks out real connections, using a fake connection | 17 // A connection factory that mocks out real connections, using a fake connection |
17 // handler instead. | 18 // handler instead. |
18 class FakeConnectionFactory : public ConnectionFactory { | 19 class FakeConnectionFactory : public ConnectionFactory { |
19 public: | 20 public: |
(...skipping 16 matching lines...) Expand all Loading... |
36 // Whether a connection reset has been triggered and is yet to run. | 37 // Whether a connection reset has been triggered and is yet to run. |
37 bool reconnect_pending() const { return reconnect_pending_; } | 38 bool reconnect_pending() const { return reconnect_pending_; } |
38 | 39 |
39 // Whether connection resets should be handled immediately or delayed until | 40 // Whether connection resets should be handled immediately or delayed until |
40 // release. | 41 // release. |
41 void set_delay_reconnect(bool should_delay) { | 42 void set_delay_reconnect(bool should_delay) { |
42 delay_reconnect_ = should_delay; | 43 delay_reconnect_ = should_delay; |
43 } | 44 } |
44 | 45 |
45 private: | 46 private: |
46 scoped_ptr<FakeConnectionHandler> connection_handler_; | 47 std::unique_ptr<FakeConnectionHandler> connection_handler_; |
47 | 48 |
48 BuildLoginRequestCallback request_builder_; | 49 BuildLoginRequestCallback request_builder_; |
49 | 50 |
50 // Logic for handling connection resets. | 51 // Logic for handling connection resets. |
51 bool reconnect_pending_; | 52 bool reconnect_pending_; |
52 bool delay_reconnect_; | 53 bool delay_reconnect_; |
53 | 54 |
54 ConnectionListener* connection_listener_; | 55 ConnectionListener* connection_listener_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(FakeConnectionFactory); | 57 DISALLOW_COPY_AND_ASSIGN(FakeConnectionFactory); |
57 }; | 58 }; |
58 | 59 |
59 } // namespace gcm | 60 } // namespace gcm |
60 | 61 |
61 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ | 62 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_FACTORY_H_ |
OLD | NEW |