Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: google_apis/gcm/engine/mcs_client_unittest.cc

Issue 641943002: components: Introduce AlarmTimer class and use it for GCM heartbeat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build error in mcs_probe Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « google_apis/gcm/engine/mcs_client.cc ('k') | google_apis/gcm/tools/mcs_probe.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/mcs_client.h" 5 #include "google_apis/gcm/engine/mcs_client.h"
6 6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 13 #include "base/run_loop.h"
11 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
12 #include "base/test/simple_test_clock.h" 15 #include "base/test/simple_test_clock.h"
16 #include "base/timer/timer.h"
13 #include "google_apis/gcm/base/fake_encryptor.h" 17 #include "google_apis/gcm/base/fake_encryptor.h"
14 #include "google_apis/gcm/base/mcs_util.h" 18 #include "google_apis/gcm/base/mcs_util.h"
15 #include "google_apis/gcm/engine/fake_connection_factory.h" 19 #include "google_apis/gcm/engine/fake_connection_factory.h"
16 #include "google_apis/gcm/engine/fake_connection_handler.h" 20 #include "google_apis/gcm/engine/fake_connection_handler.h"
17 #include "google_apis/gcm/engine/gcm_store_impl.h" 21 #include "google_apis/gcm/engine/gcm_store_impl.h"
18 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h" 22 #include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
19 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
20 24
21 namespace gcm { 25 namespace gcm {
22 26
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return MCSMessage(kDataMessageStanzaTag, data_message); 67 return MCSMessage(kDataMessageStanzaTag, data_message);
64 } 68 }
65 69
66 // MCSClient with overriden exposed persistent id logic. 70 // MCSClient with overriden exposed persistent id logic.
67 class TestMCSClient : public MCSClient { 71 class TestMCSClient : public MCSClient {
68 public: 72 public:
69 TestMCSClient(base::Clock* clock, 73 TestMCSClient(base::Clock* clock,
70 ConnectionFactory* connection_factory, 74 ConnectionFactory* connection_factory,
71 GCMStore* gcm_store, 75 GCMStore* gcm_store,
72 gcm::GCMStatsRecorder* recorder) 76 gcm::GCMStatsRecorder* recorder)
73 : MCSClient("", clock, connection_factory, gcm_store, recorder), 77 : MCSClient("", clock, connection_factory, gcm_store, recorder,
78 make_scoped_ptr(new base::Timer(true, false))),
74 next_id_(0) { 79 next_id_(0) {
75 } 80 }
76 81
77 std::string GetNextPersistentId() override { 82 std::string GetNextPersistentId() override {
78 return base::UintToString(++next_id_); 83 return base::UintToString(++next_id_);
79 } 84 }
80 85
81 private: 86 private:
82 uint32 next_id_; 87 uint32 next_id_;
83 }; 88 };
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 866
862 LoginClient(std::vector<std::string>()); 867 LoginClient(std::vector<std::string>());
863 GetFakeHandler()->ExpectOutgoingMessage(message); 868 GetFakeHandler()->ExpectOutgoingMessage(message);
864 GetFakeHandler()->ExpectOutgoingMessage(message2); 869 GetFakeHandler()->ExpectOutgoingMessage(message2);
865 PumpLoop(); 870 PumpLoop();
866 } 871 }
867 872
868 } // namespace 873 } // namespace
869 874
870 } // namespace gcm 875 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/mcs_client.cc ('k') | google_apis/gcm/tools/mcs_probe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698