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

Side by Side Diff: components/invalidation/invalidation_logger_unittest.cc

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
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/invalidation/invalidation_logger.h" 5 #include "components/invalidation/invalidation_logger.h"
6 #include "components/invalidation/invalidation_logger_observer.h" 6 #include "components/invalidation/invalidation_logger_observer.h"
7 7
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace invalidation { 10 namespace invalidation {
11 11
12 class InvalidationLoggerObserverTest : public InvalidationLoggerObserver { 12 class InvalidationLoggerObserverTest : public InvalidationLoggerObserver {
13 public: 13 public:
14 InvalidationLoggerObserverTest() { ResetStates(); } 14 InvalidationLoggerObserverTest() { ResetStates(); }
15 15
16 void ResetStates() { 16 void ResetStates() {
17 registration_change_received = false; 17 registration_change_received = false;
18 state_received = false; 18 state_received = false;
19 update_id_received = false; 19 update_id_received = false;
20 debug_message_received = false; 20 debug_message_received = false;
21 invalidation_received = false; 21 invalidation_received = false;
22 detailed_status_received = false; 22 detailed_status_received = false;
23 update_id_replicated = std::map<std::string, syncer::ObjectIdCountMap>(); 23 update_id_replicated = std::map<std::string, syncer::ObjectIdCountMap>();
24 registered_handlers = std::multiset<std::string>(); 24 registered_handlers = std::multiset<std::string>();
25 } 25 }
26 26
27 virtual void OnRegistrationChange(const std::multiset<std::string>& handlers) 27 void OnRegistrationChange(
28 override { 28 const std::multiset<std::string>& handlers) override {
29 registered_handlers = handlers; 29 registered_handlers = handlers;
30 registration_change_received = true; 30 registration_change_received = true;
31 } 31 }
32 32
33 virtual void OnStateChange(const syncer::InvalidatorState& new_state, 33 void OnStateChange(const syncer::InvalidatorState& new_state,
34 const base::Time& last_change_timestamp) 34 const base::Time& last_change_timestamp) override {
35 override {
36 state_received = true; 35 state_received = true;
37 } 36 }
38 37
39 virtual void OnUpdateIds(const std::string& handler, 38 void OnUpdateIds(const std::string& handler,
40 const syncer::ObjectIdCountMap& details) override { 39 const syncer::ObjectIdCountMap& details) override {
41 update_id_received = true; 40 update_id_received = true;
42 update_id_replicated[handler] = details; 41 update_id_replicated[handler] = details;
43 } 42 }
44 43
45 virtual void OnDebugMessage(const base::DictionaryValue& details) override { 44 void OnDebugMessage(const base::DictionaryValue& details) override {
46 debug_message_received = true; 45 debug_message_received = true;
47 } 46 }
48 47
49 virtual void OnInvalidation( 48 void OnInvalidation(
50 const syncer::ObjectIdInvalidationMap& new_invalidations) override { 49 const syncer::ObjectIdInvalidationMap& new_invalidations) override {
51 invalidation_received = true; 50 invalidation_received = true;
52 } 51 }
53 52
54 virtual void OnDetailedStatus(const base::DictionaryValue& details) override { 53 void OnDetailedStatus(const base::DictionaryValue& details) override {
55 detailed_status_received = true; 54 detailed_status_received = true;
56 } 55 }
57 56
58 bool registration_change_received; 57 bool registration_change_received;
59 bool state_received; 58 bool state_received;
60 bool update_id_received; 59 bool update_id_received;
61 bool debug_message_received; 60 bool debug_message_received;
62 bool invalidation_received; 61 bool invalidation_received;
63 bool detailed_status_received; 62 bool detailed_status_received;
64 std::map<std::string, syncer::ObjectIdCountMap> update_id_replicated; 63 std::map<std::string, syncer::ObjectIdCountMap> update_id_replicated;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 276
278 observer_test.ResetStates(); 277 observer_test.ResetStates();
279 log.OnUnregistration(std::string("FakeHandler2")); 278 log.OnUnregistration(std::string("FakeHandler2"));
280 test_multiset.erase("FakeHandler2"); 279 test_multiset.erase("FakeHandler2");
281 EXPECT_TRUE(observer_test.registration_change_received); 280 EXPECT_TRUE(observer_test.registration_change_received);
282 EXPECT_EQ(observer_test.registered_handlers, test_multiset); 281 EXPECT_EQ(observer_test.registered_handlers, test_multiset);
283 282
284 log.UnregisterObserver(&observer_test); 283 log.UnregisterObserver(&observer_test);
285 } 284 }
286 } // namespace invalidation 285 } // namespace invalidation
OLDNEW
« no previous file with comments | « components/invalidation/gcm_network_channel_unittest.cc ('k') | components/invalidation/invalidation_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698