| 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 "sync/test/mock_invalidation_tracker.h" | 5 #include "components/sync/test/mock_invalidation_tracker.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "sync/test/trackable_mock_invalidation.h" | 10 #include "components/sync/test/trackable_mock_invalidation.h" |
| 11 | 11 |
| 12 namespace syncer { | 12 namespace syncer { |
| 13 | 13 |
| 14 std::unique_ptr<TrackableMockInvalidation> | 14 std::unique_ptr<TrackableMockInvalidation> |
| 15 MockInvalidationTracker::IssueUnknownVersionInvalidation() { | 15 MockInvalidationTracker::IssueUnknownVersionInvalidation() { |
| 16 return std::unique_ptr<TrackableMockInvalidation>( | 16 return std::unique_ptr<TrackableMockInvalidation>( |
| 17 new TrackableMockInvalidation(true, -1, std::string(), this, next_id_++)); | 17 new TrackableMockInvalidation(true, -1, std::string(), this, next_id_++)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 std::unique_ptr<TrackableMockInvalidation> | 20 std::unique_ptr<TrackableMockInvalidation> |
| 21 MockInvalidationTracker::IssueInvalidation(int64_t version, | 21 MockInvalidationTracker::IssueInvalidation(int64_t version, |
| 22 const std::string& payload) { | 22 const std::string& payload) { |
| 23 return std::unique_ptr<TrackableMockInvalidation>( | 23 return std::unique_ptr<TrackableMockInvalidation>( |
| 24 new TrackableMockInvalidation(false, version, payload, this, next_id_++)); | 24 new TrackableMockInvalidation(false, version, payload, this, next_id_++)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 MockInvalidationTracker::MockInvalidationTracker() : next_id_(0) { | 27 MockInvalidationTracker::MockInvalidationTracker() : next_id_(0) {} |
| 28 } | |
| 29 | 28 |
| 30 MockInvalidationTracker::~MockInvalidationTracker() { | 29 MockInvalidationTracker::~MockInvalidationTracker() {} |
| 31 } | |
| 32 | 30 |
| 33 void MockInvalidationTracker::Acknowledge(int invalidation_id) { | 31 void MockInvalidationTracker::Acknowledge(int invalidation_id) { |
| 34 acknowledged_.insert(invalidation_id); | 32 acknowledged_.insert(invalidation_id); |
| 35 } | 33 } |
| 36 | 34 |
| 37 void MockInvalidationTracker::Drop(int invalidation_id) { | 35 void MockInvalidationTracker::Drop(int invalidation_id) { |
| 38 dropped_.insert(invalidation_id); | 36 dropped_.insert(invalidation_id); |
| 39 } | 37 } |
| 40 | 38 |
| 41 bool MockInvalidationTracker::IsUnacked(int invalidation_id) const { | 39 bool MockInvalidationTracker::IsUnacked(int invalidation_id) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 bool MockInvalidationTracker::AllInvalidationsAccountedFor() const { | 54 bool MockInvalidationTracker::AllInvalidationsAccountedFor() const { |
| 57 for (int i = 0; i < next_id_; ++i) { | 55 for (int i = 0; i < next_id_; ++i) { |
| 58 if (IsUnacked(i)) { | 56 if (IsUnacked(i)) { |
| 59 return false; | 57 return false; |
| 60 } | 58 } |
| 61 } | 59 } |
| 62 return true; | 60 return true; |
| 63 } | 61 } |
| 64 | 62 |
| 65 } // namespace syncer | 63 } // namespace syncer |
| OLD | NEW |