| 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
| 6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
| 7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 sync_manager_.ShutdownOnSyncThread(); | 782 sync_manager_.ShutdownOnSyncThread(); |
| 783 // We can't assert that |sync_manager_| isn't registered with | 783 // We can't assert that |sync_manager_| isn't registered with |
| 784 // |fake_invalidator_| anymore because |fake_invalidator_| is now | 784 // |fake_invalidator_| anymore because |fake_invalidator_| is now |
| 785 // destroyed. | 785 // destroyed. |
| 786 fake_invalidator_ = NULL; | 786 fake_invalidator_ = NULL; |
| 787 PumpLoop(); | 787 PumpLoop(); |
| 788 } | 788 } |
| 789 | 789 |
| 790 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { | 790 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { |
| 791 (*out)[NIGORI] = GROUP_PASSIVE; | 791 (*out)[NIGORI] = GROUP_PASSIVE; |
| 792 (*out)[DEVICE_INFO] = GROUP_PASSIVE; |
| 792 (*out)[BOOKMARKS] = GROUP_PASSIVE; | 793 (*out)[BOOKMARKS] = GROUP_PASSIVE; |
| 793 (*out)[THEMES] = GROUP_PASSIVE; | 794 (*out)[THEMES] = GROUP_PASSIVE; |
| 794 (*out)[SESSIONS] = GROUP_PASSIVE; | 795 (*out)[SESSIONS] = GROUP_PASSIVE; |
| 795 (*out)[PASSWORDS] = GROUP_PASSIVE; | 796 (*out)[PASSWORDS] = GROUP_PASSIVE; |
| 796 (*out)[PREFERENCES] = GROUP_PASSIVE; | 797 (*out)[PREFERENCES] = GROUP_PASSIVE; |
| 797 } | 798 } |
| 798 | 799 |
| 799 virtual void OnChangesApplied( | 800 virtual void OnChangesApplied( |
| 800 ModelType model_type, | 801 ModelType model_type, |
| 801 const BaseTransaction* trans, | 802 const BaseTransaction* trans, |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 ListValue args; | 1176 ListValue args; |
| 1176 args.Append(Value::CreateStringValue("1")); | 1177 args.Append(Value::CreateStringValue("1")); |
| 1177 SendJsMessage("getChildNodeIds", | 1178 SendJsMessage("getChildNodeIds", |
| 1178 JsArgList(&args), reply_handler.AsWeakHandle()); | 1179 JsArgList(&args), reply_handler.AsWeakHandle()); |
| 1179 } | 1180 } |
| 1180 | 1181 |
| 1181 EXPECT_EQ(1u, return_args.Get().GetSize()); | 1182 EXPECT_EQ(1u, return_args.Get().GetSize()); |
| 1182 const ListValue* nodes = NULL; | 1183 const ListValue* nodes = NULL; |
| 1183 ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); | 1184 ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); |
| 1184 ASSERT_TRUE(nodes); | 1185 ASSERT_TRUE(nodes); |
| 1185 EXPECT_EQ(6u, nodes->GetSize()); | 1186 EXPECT_EQ(7u, nodes->GetSize()); |
| 1186 } | 1187 } |
| 1187 | 1188 |
| 1188 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { | 1189 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { |
| 1189 StrictMock<MockJsReplyHandler> reply_handler; | 1190 StrictMock<MockJsReplyHandler> reply_handler; |
| 1190 | 1191 |
| 1191 ListValue empty_list_args; | 1192 ListValue empty_list_args; |
| 1192 empty_list_args.Append(new ListValue()); | 1193 empty_list_args.Append(new ListValue()); |
| 1193 | 1194 |
| 1194 EXPECT_CALL(reply_handler, | 1195 EXPECT_CALL(reply_handler, |
| 1195 HandleJsReply("getChildNodeIds", | 1196 HandleJsReply("getChildNodeIds", |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 | 2884 |
| 2884 // Verify only the non-disabled types remain after cleanup. | 2885 // Verify only the non-disabled types remain after cleanup. |
| 2885 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 2886 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
| 2886 EXPECT_TRUE(new_enabled_types.Equals( | 2887 EXPECT_TRUE(new_enabled_types.Equals( |
| 2887 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); | 2888 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); |
| 2888 EXPECT_TRUE(disabled_types.Equals( | 2889 EXPECT_TRUE(disabled_types.Equals( |
| 2889 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 2890 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
| 2890 } | 2891 } |
| 2891 | 2892 |
| 2892 } // namespace | 2893 } // namespace |
| OLD | NEW |