| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 | 856 |
| 857 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { | 857 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { |
| 858 (*out)[NIGORI] = GROUP_PASSIVE; | 858 (*out)[NIGORI] = GROUP_PASSIVE; |
| 859 (*out)[DEVICE_INFO] = GROUP_PASSIVE; | 859 (*out)[DEVICE_INFO] = GROUP_PASSIVE; |
| 860 (*out)[EXPERIMENTS] = GROUP_PASSIVE; | 860 (*out)[EXPERIMENTS] = GROUP_PASSIVE; |
| 861 (*out)[BOOKMARKS] = GROUP_PASSIVE; | 861 (*out)[BOOKMARKS] = GROUP_PASSIVE; |
| 862 (*out)[THEMES] = GROUP_PASSIVE; | 862 (*out)[THEMES] = GROUP_PASSIVE; |
| 863 (*out)[SESSIONS] = GROUP_PASSIVE; | 863 (*out)[SESSIONS] = GROUP_PASSIVE; |
| 864 (*out)[PASSWORDS] = GROUP_PASSIVE; | 864 (*out)[PASSWORDS] = GROUP_PASSIVE; |
| 865 (*out)[PREFERENCES] = GROUP_PASSIVE; | 865 (*out)[PREFERENCES] = GROUP_PASSIVE; |
| 866 (*out)[PRIORITY_PREFERENCES] = GROUP_PASSIVE; |
| 866 } | 867 } |
| 867 | 868 |
| 868 virtual void OnChangesApplied( | 869 virtual void OnChangesApplied( |
| 869 ModelType model_type, | 870 ModelType model_type, |
| 870 int64 model_version, | 871 int64 model_version, |
| 871 const BaseTransaction* trans, | 872 const BaseTransaction* trans, |
| 872 const ImmutableChangeRecordList& changes) OVERRIDE {} | 873 const ImmutableChangeRecordList& changes) OVERRIDE {} |
| 873 | 874 |
| 874 virtual void OnChangesComplete(ModelType model_type) OVERRIDE {} | 875 virtual void OnChangesComplete(ModelType model_type) OVERRIDE {} |
| 875 | 876 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 ListValue args; | 1241 ListValue args; |
| 1241 args.Append(Value::CreateStringValue("1")); | 1242 args.Append(Value::CreateStringValue("1")); |
| 1242 SendJsMessage("getChildNodeIds", | 1243 SendJsMessage("getChildNodeIds", |
| 1243 JsArgList(&args), reply_handler.AsWeakHandle()); | 1244 JsArgList(&args), reply_handler.AsWeakHandle()); |
| 1244 } | 1245 } |
| 1245 | 1246 |
| 1246 EXPECT_EQ(1u, return_args.Get().GetSize()); | 1247 EXPECT_EQ(1u, return_args.Get().GetSize()); |
| 1247 const ListValue* nodes = NULL; | 1248 const ListValue* nodes = NULL; |
| 1248 ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); | 1249 ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); |
| 1249 ASSERT_TRUE(nodes); | 1250 ASSERT_TRUE(nodes); |
| 1250 EXPECT_EQ(8u, nodes->GetSize()); | 1251 EXPECT_EQ(9u, nodes->GetSize()); |
| 1251 } | 1252 } |
| 1252 | 1253 |
| 1253 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { | 1254 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { |
| 1254 StrictMock<MockJsReplyHandler> reply_handler; | 1255 StrictMock<MockJsReplyHandler> reply_handler; |
| 1255 | 1256 |
| 1256 ListValue empty_list_args; | 1257 ListValue empty_list_args; |
| 1257 empty_list_args.Append(new ListValue()); | 1258 empty_list_args.Append(new ListValue()); |
| 1258 | 1259 |
| 1259 EXPECT_CALL(reply_handler, | 1260 EXPECT_CALL(reply_handler, |
| 1260 HandleJsReply("getChildNodeIds", | 1261 HandleJsReply("getChildNodeIds", |
| (...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3057 Difference(ModelTypeSet::All(), disabled_types); | 3058 Difference(ModelTypeSet::All(), disabled_types); |
| 3058 | 3059 |
| 3059 // Verify only the non-disabled types remain after cleanup. | 3060 // Verify only the non-disabled types remain after cleanup. |
| 3060 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); | 3061 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); |
| 3061 EXPECT_TRUE(new_enabled_types.Equals(sync_manager_.InitialSyncEndedTypes())); | 3062 EXPECT_TRUE(new_enabled_types.Equals(sync_manager_.InitialSyncEndedTypes())); |
| 3062 EXPECT_TRUE(disabled_types.Equals( | 3063 EXPECT_TRUE(disabled_types.Equals( |
| 3063 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); | 3064 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); |
| 3064 } | 3065 } |
| 3065 | 3066 |
| 3066 } // namespace | 3067 } // namespace |
| OLD | NEW |