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