OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/engine/download.h" | 5 #include "sync/engine/download.h" |
| 6 #include "sync/internal_api/public/base/model_type_test_util.h" |
6 #include "sync/protocol/sync.pb.h" | 7 #include "sync/protocol/sync.pb.h" |
7 #include "sync/sessions/nudge_tracker.h" | 8 #include "sync/sessions/nudge_tracker.h" |
8 #include "sync/test/engine/fake_model_worker.h" | 9 #include "sync/test/engine/fake_model_worker.h" |
9 #include "sync/test/engine/syncer_command_test.h" | 10 #include "sync/test/engine/syncer_command_test.h" |
10 | 11 |
11 namespace syncer { | 12 namespace syncer { |
12 | 13 |
13 // A test fixture for tests exercising download updates functions. | 14 // A test fixture for tests exercising download updates functions. |
14 class DownloadUpdatesTest : public SyncerCommandTest { | 15 class DownloadUpdatesTest : public SyncerCommandTest { |
15 protected: | 16 protected: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 EXPECT_FALSE(progress_marker.has_notification_hint()); | 72 EXPECT_FALSE(progress_marker.has_notification_hint()); |
72 EXPECT_EQ(0, gu_trigger.local_modification_nudges()); | 73 EXPECT_EQ(0, gu_trigger.local_modification_nudges()); |
73 EXPECT_EQ(0, gu_trigger.datatype_refresh_nudges()); | 74 EXPECT_EQ(0, gu_trigger.datatype_refresh_nudges()); |
74 } | 75 } |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 TEST_F(DownloadUpdatesTest, ExecuteWithStates) { | 79 TEST_F(DownloadUpdatesTest, ExecuteWithStates) { |
79 sessions::NudgeTracker nudge_tracker; | 80 sessions::NudgeTracker nudge_tracker; |
80 nudge_tracker.RecordRemoteInvalidation( | 81 nudge_tracker.RecordRemoteInvalidation( |
81 ModelTypeSetToInvalidationMap(ModelTypeSet(AUTOFILL), | 82 BuildInvalidationMap(AUTOFILL, 1, "autofill_payload")); |
82 "autofill_payload")); | |
83 nudge_tracker.RecordRemoteInvalidation( | 83 nudge_tracker.RecordRemoteInvalidation( |
84 ModelTypeSetToInvalidationMap(ModelTypeSet(BOOKMARKS), | 84 BuildInvalidationMap(BOOKMARKS, 1, "bookmark_payload")); |
85 "bookmark_payload")); | |
86 nudge_tracker.RecordRemoteInvalidation( | 85 nudge_tracker.RecordRemoteInvalidation( |
87 ModelTypeSetToInvalidationMap(ModelTypeSet(PREFERENCES), | 86 BuildInvalidationMap(PREFERENCES, 1, "preferences_payload")); |
88 "preferences_payload")); | |
89 ModelTypeSet notified_types; | 87 ModelTypeSet notified_types; |
90 notified_types.Put(AUTOFILL); | 88 notified_types.Put(AUTOFILL); |
91 notified_types.Put(BOOKMARKS); | 89 notified_types.Put(BOOKMARKS); |
92 notified_types.Put(PREFERENCES); | 90 notified_types.Put(PREFERENCES); |
93 | 91 |
94 scoped_ptr<sessions::SyncSession> session( | 92 scoped_ptr<sessions::SyncSession> session( |
95 sessions::SyncSession::Build(context(), delegate())); | 93 sessions::SyncSession::Build(context(), delegate())); |
96 sync_pb::ClientToServerMessage msg; | 94 sync_pb::ClientToServerMessage msg; |
97 BuildNormalDownloadUpdates(session.get(), | 95 BuildNormalDownloadUpdates(session.get(), |
98 false, | 96 false, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 sync_pb::ClientToServerMessage msg3; | 157 sync_pb::ClientToServerMessage msg3; |
160 BuildNormalDownloadUpdates(session2.get(), | 158 BuildNormalDownloadUpdates(session2.get(), |
161 false, | 159 false, |
162 GetRoutingInfoTypes(routing_info()), | 160 GetRoutingInfoTypes(routing_info()), |
163 nudge_tracker, | 161 nudge_tracker, |
164 &msg3); | 162 &msg3); |
165 EXPECT_EQ(0, msg3.debug_info().events_size()); | 163 EXPECT_EQ(0, msg3.debug_info().events_size()); |
166 } | 164 } |
167 | 165 |
168 } // namespace syncer | 166 } // namespace syncer |
OLD | NEW |