| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sessions/nudge_tracker.h" | 5 #include "sync/sessions/nudge_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | |
| 10 #include <string> | 9 #include <string> |
| 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "sync/internal_api/public/base/model_type_test_util.h" | 15 #include "sync/internal_api/public/base/model_type_test_util.h" |
| 16 #include "sync/test/mock_invalidation.h" | 16 #include "sync/test/mock_invalidation.h" |
| 17 #include "sync/test/mock_invalidation_tracker.h" | 17 #include "sync/test/mock_invalidation_tracker.h" |
| 18 #include "sync/test/trackable_mock_invalidation.h" | 18 #include "sync/test/trackable_mock_invalidation.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 20 |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 return tracker_.IsDropped(tracking_id); | 834 return tracker_.IsDropped(tracking_id); |
| 835 } | 835 } |
| 836 | 836 |
| 837 int SendInvalidation(ModelType type, int version, const std::string& hint) { | 837 int SendInvalidation(ModelType type, int version, const std::string& hint) { |
| 838 // Build and register the invalidation. | 838 // Build and register the invalidation. |
| 839 scoped_ptr<TrackableMockInvalidation> inv = | 839 scoped_ptr<TrackableMockInvalidation> inv = |
| 840 tracker_.IssueInvalidation(version, hint); | 840 tracker_.IssueInvalidation(version, hint); |
| 841 int id = inv->GetTrackingId(); | 841 int id = inv->GetTrackingId(); |
| 842 | 842 |
| 843 // Send it to the NudgeTracker. | 843 // Send it to the NudgeTracker. |
| 844 nudge_tracker_.RecordRemoteInvalidation(type, inv.Pass()); | 844 nudge_tracker_.RecordRemoteInvalidation(type, std::move(inv)); |
| 845 | 845 |
| 846 // Return its ID to the test framework for use in assertions. | 846 // Return its ID to the test framework for use in assertions. |
| 847 return id; | 847 return id; |
| 848 } | 848 } |
| 849 | 849 |
| 850 int SendUnknownVersionInvalidation(ModelType type) { | 850 int SendUnknownVersionInvalidation(ModelType type) { |
| 851 // Build and register the invalidation. | 851 // Build and register the invalidation. |
| 852 scoped_ptr<TrackableMockInvalidation> inv = | 852 scoped_ptr<TrackableMockInvalidation> inv = |
| 853 tracker_.IssueUnknownVersionInvalidation(); | 853 tracker_.IssueUnknownVersionInvalidation(); |
| 854 int id = inv->GetTrackingId(); | 854 int id = inv->GetTrackingId(); |
| 855 | 855 |
| 856 // Send it to the NudgeTracker. | 856 // Send it to the NudgeTracker. |
| 857 nudge_tracker_.RecordRemoteInvalidation(type, inv.Pass()); | 857 nudge_tracker_.RecordRemoteInvalidation(type, std::move(inv)); |
| 858 | 858 |
| 859 // Return its ID to the test framework for use in assertions. | 859 // Return its ID to the test framework for use in assertions. |
| 860 return id; | 860 return id; |
| 861 } | 861 } |
| 862 | 862 |
| 863 bool AllInvalidationsAccountedFor() const { | 863 bool AllInvalidationsAccountedFor() const { |
| 864 return tracker_.AllInvalidationsAccountedFor(); | 864 return tracker_.AllInvalidationsAccountedFor(); |
| 865 } | 865 } |
| 866 | 866 |
| 867 void RecordSuccessfulSyncCycle() { | 867 void RecordSuccessfulSyncCycle() { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); | 972 EXPECT_TRUE(IsInvalidationAcknowledged(inv2_id)); |
| 973 EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id)); | 973 EXPECT_TRUE(IsInvalidationAcknowledged(inv3_id)); |
| 974 EXPECT_TRUE(IsInvalidationAcknowledged(inv4_id)); | 974 EXPECT_TRUE(IsInvalidationAcknowledged(inv4_id)); |
| 975 EXPECT_TRUE(IsInvalidationAcknowledged(inv5_id)); | 975 EXPECT_TRUE(IsInvalidationAcknowledged(inv5_id)); |
| 976 | 976 |
| 977 EXPECT_TRUE(AllInvalidationsAccountedFor()); | 977 EXPECT_TRUE(AllInvalidationsAccountedFor()); |
| 978 } | 978 } |
| 979 | 979 |
| 980 } // namespace sessions | 980 } // namespace sessions |
| 981 } // namespace syncer | 981 } // namespace syncer |
| OLD | NEW |