| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_client_impl.h" | 5 #include "components/gcm_driver/gcm_client_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 scoped_ptr<base::Clock> BuildClock() override; | 194 scoped_ptr<base::Clock> BuildClock() override; |
| 195 scoped_ptr<MCSClient> BuildMCSClient(const std::string& version, | 195 scoped_ptr<MCSClient> BuildMCSClient(const std::string& version, |
| 196 base::Clock* clock, | 196 base::Clock* clock, |
| 197 ConnectionFactory* connection_factory, | 197 ConnectionFactory* connection_factory, |
| 198 GCMStore* gcm_store, | 198 GCMStore* gcm_store, |
| 199 GCMStatsRecorder* recorder) override; | 199 GCMStatsRecorder* recorder) override; |
| 200 scoped_ptr<ConnectionFactory> BuildConnectionFactory( | 200 scoped_ptr<ConnectionFactory> BuildConnectionFactory( |
| 201 const std::vector<GURL>& endpoints, | 201 const std::vector<GURL>& endpoints, |
| 202 const net::BackoffEntry::Policy& backoff_policy, | 202 const net::BackoffEntry::Policy& backoff_policy, |
| 203 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, | 203 net::HttpNetworkSession* gcm_network_session, |
| 204 const scoped_refptr<net::HttpNetworkSession>& http_network_session, | 204 net::HttpNetworkSession* http_network_session, |
| 205 net::NetLog* net_log, | 205 net::NetLog* net_log, |
| 206 GCMStatsRecorder* recorder) override; | 206 GCMStatsRecorder* recorder) override; |
| 207 | 207 |
| 208 private: | 208 private: |
| 209 base::TimeDelta clock_step_; | 209 base::TimeDelta clock_step_; |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 FakeGCMInternalsBuilder::FakeGCMInternalsBuilder(base::TimeDelta clock_step) | 212 FakeGCMInternalsBuilder::FakeGCMInternalsBuilder(base::TimeDelta clock_step) |
| 213 : clock_step_(clock_step) { | 213 : clock_step_(clock_step) { |
| 214 } | 214 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 227 GCMStatsRecorder* recorder) { | 227 GCMStatsRecorder* recorder) { |
| 228 return make_scoped_ptr<MCSClient>(new FakeMCSClient(clock, | 228 return make_scoped_ptr<MCSClient>(new FakeMCSClient(clock, |
| 229 connection_factory, | 229 connection_factory, |
| 230 gcm_store, | 230 gcm_store, |
| 231 recorder)); | 231 recorder)); |
| 232 } | 232 } |
| 233 | 233 |
| 234 scoped_ptr<ConnectionFactory> FakeGCMInternalsBuilder::BuildConnectionFactory( | 234 scoped_ptr<ConnectionFactory> FakeGCMInternalsBuilder::BuildConnectionFactory( |
| 235 const std::vector<GURL>& endpoints, | 235 const std::vector<GURL>& endpoints, |
| 236 const net::BackoffEntry::Policy& backoff_policy, | 236 const net::BackoffEntry::Policy& backoff_policy, |
| 237 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, | 237 net::HttpNetworkSession* gcm_network_session, |
| 238 const scoped_refptr<net::HttpNetworkSession>& http_network_session, | 238 net::HttpNetworkSession* http_network_session, |
| 239 net::NetLog* net_log, | 239 net::NetLog* net_log, |
| 240 GCMStatsRecorder* recorder) { | 240 GCMStatsRecorder* recorder) { |
| 241 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); | 241 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace | 244 } // namespace |
| 245 | 245 |
| 246 class GCMClientImplTest : public testing::Test, | 246 class GCMClientImplTest : public testing::Test, |
| 247 public GCMClient::Delegate { | 247 public GCMClient::Delegate { |
| 248 public: | 248 public: |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 // No need to call CompleteDeleteToken since unregistration request should | 1642 // No need to call CompleteDeleteToken since unregistration request should |
| 1643 // not be triggered. | 1643 // not be triggered. |
| 1644 PumpLoopUntilIdle(); | 1644 PumpLoopUntilIdle(); |
| 1645 | 1645 |
| 1646 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event()); | 1646 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event()); |
| 1647 EXPECT_EQ(kAppId, last_app_id()); | 1647 EXPECT_EQ(kAppId, last_app_id()); |
| 1648 EXPECT_EQ(GCMClient::SUCCESS, last_result()); | 1648 EXPECT_EQ(GCMClient::SUCCESS, last_result()); |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 } // namespace gcm | 1651 } // namespace gcm |
| OLD | NEW |