Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 10985008: sync: Add DeviceInfo protobuf and supporting code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update proto_value_conversions.cc Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 sync_manager_.ShutdownOnSyncThread(); 784 sync_manager_.ShutdownOnSyncThread();
785 // We can't assert that |sync_manager_| isn't registered with 785 // We can't assert that |sync_manager_| isn't registered with
786 // |fake_invalidator_| anymore because |fake_invalidator_| is now 786 // |fake_invalidator_| anymore because |fake_invalidator_| is now
787 // destroyed. 787 // destroyed.
788 fake_invalidator_ = NULL; 788 fake_invalidator_ = NULL;
789 PumpLoop(); 789 PumpLoop();
790 } 790 }
791 791
792 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 792 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
793 (*out)[NIGORI] = GROUP_PASSIVE; 793 (*out)[NIGORI] = GROUP_PASSIVE;
794 (*out)[DEVICE_INFO] = GROUP_PASSIVE;
794 (*out)[BOOKMARKS] = GROUP_PASSIVE; 795 (*out)[BOOKMARKS] = GROUP_PASSIVE;
795 (*out)[THEMES] = GROUP_PASSIVE; 796 (*out)[THEMES] = GROUP_PASSIVE;
796 (*out)[SESSIONS] = GROUP_PASSIVE; 797 (*out)[SESSIONS] = GROUP_PASSIVE;
797 (*out)[PASSWORDS] = GROUP_PASSIVE; 798 (*out)[PASSWORDS] = GROUP_PASSIVE;
798 (*out)[PREFERENCES] = GROUP_PASSIVE; 799 (*out)[PREFERENCES] = GROUP_PASSIVE;
799 } 800 }
800 801
801 virtual void OnChangesApplied( 802 virtual void OnChangesApplied(
802 ModelType model_type, 803 ModelType model_type,
803 const BaseTransaction* trans, 804 const BaseTransaction* trans,
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 ListValue args; 1177 ListValue args;
1177 args.Append(Value::CreateStringValue("1")); 1178 args.Append(Value::CreateStringValue("1"));
1178 SendJsMessage("getChildNodeIds", 1179 SendJsMessage("getChildNodeIds",
1179 JsArgList(&args), reply_handler.AsWeakHandle()); 1180 JsArgList(&args), reply_handler.AsWeakHandle());
1180 } 1181 }
1181 1182
1182 EXPECT_EQ(1u, return_args.Get().GetSize()); 1183 EXPECT_EQ(1u, return_args.Get().GetSize());
1183 const ListValue* nodes = NULL; 1184 const ListValue* nodes = NULL;
1184 ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); 1185 ASSERT_TRUE(return_args.Get().GetList(0, &nodes));
1185 ASSERT_TRUE(nodes); 1186 ASSERT_TRUE(nodes);
1186 EXPECT_EQ(6u, nodes->GetSize()); 1187 EXPECT_EQ(7u, nodes->GetSize());
1187 } 1188 }
1188 1189
1189 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) { 1190 TEST_F(SyncManagerTest, GetChildNodeIdsFailure) {
1190 StrictMock<MockJsReplyHandler> reply_handler; 1191 StrictMock<MockJsReplyHandler> reply_handler;
1191 1192
1192 ListValue empty_list_args; 1193 ListValue empty_list_args;
1193 empty_list_args.Append(new ListValue()); 1194 empty_list_args.Append(new ListValue());
1194 1195
1195 EXPECT_CALL(reply_handler, 1196 EXPECT_CALL(reply_handler,
1196 HandleJsReply("getChildNodeIds", 1197 HandleJsReply("getChildNodeIds",
(...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 2885
2885 // Verify only the non-disabled types remain after cleanup. 2886 // Verify only the non-disabled types remain after cleanup.
2886 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); 2887 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types);
2887 EXPECT_TRUE(new_enabled_types.Equals( 2888 EXPECT_TRUE(new_enabled_types.Equals(
2888 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); 2889 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types)));
2889 EXPECT_TRUE(disabled_types.Equals( 2890 EXPECT_TRUE(disabled_types.Equals(
2890 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); 2891 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All())));
2891 } 2892 }
2892 2893
2893 } // namespace 2894 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698