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, | |
206 GCMStatsRecorder* recorder) override; | 205 GCMStatsRecorder* recorder) override; |
207 | 206 |
208 private: | 207 private: |
209 base::TimeDelta clock_step_; | 208 base::TimeDelta clock_step_; |
210 }; | 209 }; |
211 | 210 |
212 FakeGCMInternalsBuilder::FakeGCMInternalsBuilder(base::TimeDelta clock_step) | 211 FakeGCMInternalsBuilder::FakeGCMInternalsBuilder(base::TimeDelta clock_step) |
213 : clock_step_(clock_step) { | 212 : clock_step_(clock_step) { |
214 } | 213 } |
215 | 214 |
(...skipping 11 matching lines...) Expand all Loading... |
227 GCMStatsRecorder* recorder) { | 226 GCMStatsRecorder* recorder) { |
228 return make_scoped_ptr<MCSClient>(new FakeMCSClient(clock, | 227 return make_scoped_ptr<MCSClient>(new FakeMCSClient(clock, |
229 connection_factory, | 228 connection_factory, |
230 gcm_store, | 229 gcm_store, |
231 recorder)); | 230 recorder)); |
232 } | 231 } |
233 | 232 |
234 scoped_ptr<ConnectionFactory> FakeGCMInternalsBuilder::BuildConnectionFactory( | 233 scoped_ptr<ConnectionFactory> FakeGCMInternalsBuilder::BuildConnectionFactory( |
235 const std::vector<GURL>& endpoints, | 234 const std::vector<GURL>& endpoints, |
236 const net::BackoffEntry::Policy& backoff_policy, | 235 const net::BackoffEntry::Policy& backoff_policy, |
237 const scoped_refptr<net::HttpNetworkSession>& gcm_network_session, | 236 net::HttpNetworkSession* gcm_network_session, |
238 const scoped_refptr<net::HttpNetworkSession>& http_network_session, | 237 net::HttpNetworkSession* http_network_session, |
239 net::NetLog* net_log, | |
240 GCMStatsRecorder* recorder) { | 238 GCMStatsRecorder* recorder) { |
241 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); | 239 return make_scoped_ptr<ConnectionFactory>(new FakeConnectionFactory()); |
242 } | 240 } |
243 | 241 |
244 } // namespace | 242 } // namespace |
245 | 243 |
246 class GCMClientImplTest : public testing::Test, | 244 class GCMClientImplTest : public testing::Test, |
247 public GCMClient::Delegate { | 245 public GCMClient::Delegate { |
248 public: | 246 public: |
249 GCMClientImplTest(); | 247 GCMClientImplTest(); |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 // No need to call CompleteDeleteToken since unregistration request should | 1640 // No need to call CompleteDeleteToken since unregistration request should |
1643 // not be triggered. | 1641 // not be triggered. |
1644 PumpLoopUntilIdle(); | 1642 PumpLoopUntilIdle(); |
1645 | 1643 |
1646 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event()); | 1644 EXPECT_EQ(UNREGISTRATION_COMPLETED, last_event()); |
1647 EXPECT_EQ(kAppId, last_app_id()); | 1645 EXPECT_EQ(kAppId, last_app_id()); |
1648 EXPECT_EQ(GCMClient::SUCCESS, last_result()); | 1646 EXPECT_EQ(GCMClient::SUCCESS, last_result()); |
1649 } | 1647 } |
1650 | 1648 |
1651 } // namespace gcm | 1649 } // namespace gcm |
OLD | NEW |