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

Side by Side Diff: chrome/browser/sync/internal_api/syncapi_unittest.cc

Issue 7767013: Add logic to flip Nigori bit to instruct other clients to sync tabs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix CHECK on startup Created 9 years, 3 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
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 int update_enabled_types_call_count_; 909 int update_enabled_types_call_count_;
910 }; 910 };
911 911
912 TEST_F(SyncManagerTest, UpdateEnabledTypes) { 912 TEST_F(SyncManagerTest, UpdateEnabledTypes) {
913 EXPECT_EQ(1, update_enabled_types_call_count_); 913 EXPECT_EQ(1, update_enabled_types_call_count_);
914 // Triggers SyncNotifierUpdateEnabledTypes. 914 // Triggers SyncNotifierUpdateEnabledTypes.
915 sync_manager_.UpdateEnabledTypes(); 915 sync_manager_.UpdateEnabledTypes();
916 EXPECT_EQ(2, update_enabled_types_call_count_); 916 EXPECT_EQ(2, update_enabled_types_call_count_);
917 } 917 }
918 918
919 TEST_F(SyncManagerTest, DoNotSyncTabsInNigoriNode) {
920 syncable::ModelTypeSet encrypted_types;
921 encrypted_types.insert(syncable::TYPED_URLS);
922 sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types);
923
924 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
925 ReadNode node(&trans);
926 ASSERT_TRUE(node.InitByIdLookup(GetIdForDataType(syncable::NIGORI)));
927 EXPECT_FALSE(node.GetNigoriSpecifics().sync_tabs());
928 }
929
930 TEST_F(SyncManagerTest, SyncTabsInNigoriNode) {
931 syncable::ModelTypeSet encrypted_types;
932 encrypted_types.insert(syncable::SESSIONS);
933 sync_manager_.MaybeSetSyncTabsInNigoriNode(encrypted_types);
934
935 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
936 ReadNode node(&trans);
937 ASSERT_TRUE(node.InitByIdLookup(GetIdForDataType(syncable::NIGORI)));
938 EXPECT_TRUE(node.GetNigoriSpecifics().sync_tabs());
939 }
940
919 TEST_F(SyncManagerTest, ProcessJsMessage) { 941 TEST_F(SyncManagerTest, ProcessJsMessage) {
920 const JsArgList kNoArgs; 942 const JsArgList kNoArgs;
921 943
922 StrictMock<MockJsReplyHandler> reply_handler; 944 StrictMock<MockJsReplyHandler> reply_handler;
923 945
924 ListValue false_args; 946 ListValue false_args;
925 false_args.Append(Value::CreateBooleanValue(false)); 947 false_args.Append(Value::CreateBooleanValue(false));
926 948
927 EXPECT_CALL(reply_handler, 949 EXPECT_CALL(reply_handler,
928 HandleJsReply("getNotificationState", 950 HandleJsReply("getNotificationState",
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 ReadNode node(&trans); 1514 ReadNode node(&trans);
1493 EXPECT_TRUE(node.InitByIdLookup(node1)); 1515 EXPECT_TRUE(node.InitByIdLookup(node1));
1494 EXPECT_EQ(syncable::BOOKMARKS, node.GetModelType()); 1516 EXPECT_EQ(syncable::BOOKMARKS, node.GetModelType());
1495 EXPECT_EQ(title, node.GetTitle()); 1517 EXPECT_EQ(title, node.GetTitle());
1496 EXPECT_EQ(title, node.GetBookmarkSpecifics().title()); 1518 EXPECT_EQ(title, node.GetBookmarkSpecifics().title());
1497 EXPECT_EQ(url, node.GetBookmarkSpecifics().url()); 1519 EXPECT_EQ(url, node.GetBookmarkSpecifics().url());
1498 } 1520 }
1499 } 1521 }
1500 1522
1501 } // namespace browser_sync 1523 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698