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/invalidation/impl/registration_manager.h" | 5 #include "components/invalidation/impl/registration_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Fake invalidation client that just stores the currently-registered | 49 // Fake invalidation client that just stores the currently-registered |
50 // object IDs. | 50 // object IDs. |
51 class FakeInvalidationClient : public invalidation::InvalidationClient { | 51 class FakeInvalidationClient : public invalidation::InvalidationClient { |
52 public: | 52 public: |
53 FakeInvalidationClient() {} | 53 FakeInvalidationClient() {} |
54 | 54 |
55 ~FakeInvalidationClient() override {} | 55 ~FakeInvalidationClient() override {} |
56 | 56 |
57 void LoseRegistration(const invalidation::ObjectId& oid) { | 57 void LoseRegistration(const invalidation::ObjectId& oid) { |
58 EXPECT_TRUE(ContainsKey(registered_ids_, oid)); | 58 EXPECT_TRUE(base::ContainsKey(registered_ids_, oid)); |
59 registered_ids_.erase(oid); | 59 registered_ids_.erase(oid); |
60 } | 60 } |
61 | 61 |
62 void LoseAllRegistrations() { | 62 void LoseAllRegistrations() { |
63 registered_ids_.clear(); | 63 registered_ids_.clear(); |
64 } | 64 } |
65 | 65 |
66 // invalidation::InvalidationClient implementation. | 66 // invalidation::InvalidationClient implementation. |
67 | 67 |
68 void Start() override {} | 68 void Start() override {} |
69 void Stop() override {} | 69 void Stop() override {} |
70 void Acknowledge(const invalidation::AckHandle& handle) override {} | 70 void Acknowledge(const invalidation::AckHandle& handle) override {} |
71 | 71 |
72 void Register(const invalidation::ObjectId& oid) override { | 72 void Register(const invalidation::ObjectId& oid) override { |
73 EXPECT_FALSE(ContainsKey(registered_ids_, oid)); | 73 EXPECT_FALSE(base::ContainsKey(registered_ids_, oid)); |
74 registered_ids_.insert(oid); | 74 registered_ids_.insert(oid); |
75 } | 75 } |
76 | 76 |
77 void Register(const std::vector<invalidation::ObjectId>& oids) override { | 77 void Register(const std::vector<invalidation::ObjectId>& oids) override { |
78 // Unused for now. | 78 // Unused for now. |
79 } | 79 } |
80 | 80 |
81 void Unregister(const invalidation::ObjectId& oid) override { | 81 void Unregister(const invalidation::ObjectId& oid) override { |
82 EXPECT_TRUE(ContainsKey(registered_ids_, oid)); | 82 EXPECT_TRUE(base::ContainsKey(registered_ids_, oid)); |
83 registered_ids_.erase(oid); | 83 registered_ids_.erase(oid); |
84 } | 84 } |
85 | 85 |
86 void Unregister(const std::vector<invalidation::ObjectId>& oids) override { | 86 void Unregister(const std::vector<invalidation::ObjectId>& oids) override { |
87 // Unused for now. | 87 // Unused for now. |
88 } | 88 } |
89 | 89 |
90 const ObjectIdSet& GetRegisteredIdsForTest() const { | 90 const ObjectIdSet& GetRegisteredIdsForTest() const { |
91 return registered_ids_; | 91 return registered_ids_; |
92 } | 92 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 fake_registration_manager_.GetPendingRegistrationsForTest()); | 424 fake_registration_manager_.GetPendingRegistrationsForTest()); |
425 | 425 |
426 fake_registration_manager_.MarkAllRegistrationsLost(); | 426 fake_registration_manager_.MarkAllRegistrationsLost(); |
427 ExpectPendingRegistrations( | 427 ExpectPendingRegistrations( |
428 enabled_ids, 0.0, | 428 enabled_ids, 0.0, |
429 fake_registration_manager_.GetPendingRegistrationsForTest()); | 429 fake_registration_manager_.GetPendingRegistrationsForTest()); |
430 } | 430 } |
431 | 431 |
432 } // namespace | 432 } // namespace |
433 } // namespace syncer | 433 } // namespace syncer |
OLD | NEW |