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

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

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "sync/test/fake_encryptor.h" 60 #include "sync/test/fake_encryptor.h"
61 #include "sync/test/fake_extensions_activity_monitor.h" 61 #include "sync/test/fake_extensions_activity_monitor.h"
62 #include "sync/util/cryptographer.h" 62 #include "sync/util/cryptographer.h"
63 #include "sync/util/extensions_activity_monitor.h" 63 #include "sync/util/extensions_activity_monitor.h"
64 #include "sync/util/test_unrecoverable_error_handler.h" 64 #include "sync/util/test_unrecoverable_error_handler.h"
65 #include "sync/util/time.h" 65 #include "sync/util/time.h"
66 #include "testing/gmock/include/gmock/gmock.h" 66 #include "testing/gmock/include/gmock/gmock.h"
67 #include "testing/gtest/include/gtest/gtest.h" 67 #include "testing/gtest/include/gtest/gtest.h"
68 68
69 using base::ExpectDictStringValue; 69 using base::ExpectDictStringValue;
70 using csync::Cryptographer; 70 using syncer::Cryptographer;
71 using csync::FakeEncryptor; 71 using syncer::FakeEncryptor;
72 using csync::FakeExtensionsActivityMonitor; 72 using syncer::FakeExtensionsActivityMonitor;
73 using csync::HasArgsAsList; 73 using syncer::HasArgsAsList;
74 using csync::HasDetailsAsDictionary; 74 using syncer::HasDetailsAsDictionary;
75 using csync::KeyParams; 75 using syncer::KeyParams;
76 using csync::kNigoriTag; 76 using syncer::kNigoriTag;
77 using csync::JsArgList; 77 using syncer::JsArgList;
78 using csync::JsBackend; 78 using syncer::JsBackend;
79 using csync::JsEventHandler; 79 using syncer::JsEventHandler;
80 using csync::JsReplyHandler; 80 using syncer::JsReplyHandler;
81 using csync::MockJsEventHandler; 81 using syncer::MockJsEventHandler;
82 using csync::MockJsReplyHandler; 82 using syncer::MockJsReplyHandler;
83 using csync::ModelSafeRoutingInfo; 83 using syncer::ModelSafeRoutingInfo;
84 using csync::ModelSafeWorker; 84 using syncer::ModelSafeWorker;
85 using csync::sessions::SyncSessionSnapshot; 85 using syncer::sessions::SyncSessionSnapshot;
86 using csync::TestUnrecoverableErrorHandler; 86 using syncer::TestUnrecoverableErrorHandler;
87 using csync::WeakHandle; 87 using syncer::WeakHandle;
88 using syncable::IS_DEL; 88 using syncable::IS_DEL;
89 using syncable::IS_UNSYNCED; 89 using syncable::IS_UNSYNCED;
90 using syncable::kEncryptedString; 90 using syncable::kEncryptedString;
91 using syncable::ModelTypeSet; 91 using syncable::ModelTypeSet;
92 using syncable::ModelType; 92 using syncable::ModelType;
93 using syncable::NON_UNIQUE_NAME; 93 using syncable::NON_UNIQUE_NAME;
94 using syncable::SPECIFICS; 94 using syncable::SPECIFICS;
95 using testing::_; 95 using testing::_;
96 using testing::AnyNumber; 96 using testing::AnyNumber;
97 using testing::AtLeast; 97 using testing::AtLeast;
98 using testing::InSequence; 98 using testing::InSequence;
99 using testing::Invoke; 99 using testing::Invoke;
100 using testing::SaveArg; 100 using testing::SaveArg;
101 using testing::StrictMock; 101 using testing::StrictMock;
102 102
103 namespace csync { 103 namespace syncer {
104 104
105 namespace { 105 namespace {
106 106
107 const char kTestChromeVersion[] = "test chrome version"; 107 const char kTestChromeVersion[] = "test chrome version";
108 108
109 void DoNothing() {} 109 void DoNothing() {}
110 110
111 void ExpectInt64Value(int64 expected_value, 111 void ExpectInt64Value(int64 expected_value,
112 const DictionaryValue& value, const std::string& key) { 112 const DictionaryValue& value, const std::string& key) {
113 std::string int64_str; 113 std::string int64_str;
114 EXPECT_TRUE(value.GetString(key, &int64_str)); 114 EXPECT_TRUE(value.GetString(key, &int64_str));
115 int64 val = 0; 115 int64 val = 0;
116 EXPECT_TRUE(base::StringToInt64(int64_str, &val)); 116 EXPECT_TRUE(base::StringToInt64(int64_str, &val));
117 EXPECT_EQ(expected_value, val); 117 EXPECT_EQ(expected_value, val);
118 } 118 }
119 119
120 void ExpectTimeValue(const base::Time& expected_value, 120 void ExpectTimeValue(const base::Time& expected_value,
121 const DictionaryValue& value, const std::string& key) { 121 const DictionaryValue& value, const std::string& key) {
122 std::string time_str; 122 std::string time_str;
123 EXPECT_TRUE(value.GetString(key, &time_str)); 123 EXPECT_TRUE(value.GetString(key, &time_str));
124 EXPECT_EQ(csync::GetTimeDebugString(expected_value), time_str); 124 EXPECT_EQ(syncer::GetTimeDebugString(expected_value), time_str);
125 } 125 }
126 126
127 // Makes a non-folder child of the root node. Returns the id of the 127 // Makes a non-folder child of the root node. Returns the id of the
128 // newly-created node. 128 // newly-created node.
129 int64 MakeNode(UserShare* share, 129 int64 MakeNode(UserShare* share,
130 ModelType model_type, 130 ModelType model_type,
131 const std::string& client_tag) { 131 const std::string& client_tag) {
132 WriteTransaction trans(FROM_HERE, share); 132 WriteTransaction trans(FROM_HERE, share);
133 ReadNode root_node(&trans); 133 ReadNode root_node(&trans);
134 root_node.InitByRootLookup(); 134 root_node.InitByRootLookup();
135 WriteNode node(&trans); 135 WriteNode node(&trans);
136 csync::WriteNode::InitUniqueByCreationResult result = 136 syncer::WriteNode::InitUniqueByCreationResult result =
137 node.InitUniqueByCreation(model_type, root_node, client_tag); 137 node.InitUniqueByCreation(model_type, root_node, client_tag);
138 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 138 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
139 node.SetIsFolder(false); 139 node.SetIsFolder(false);
140 return node.GetId(); 140 return node.GetId();
141 } 141 }
142 142
143 // Makes a non-folder child of a non-root node. Returns the id of the 143 // Makes a non-folder child of a non-root node. Returns the id of the
144 // newly-created node. 144 // newly-created node.
145 int64 MakeNodeWithParent(UserShare* share, 145 int64 MakeNodeWithParent(UserShare* share,
146 ModelType model_type, 146 ModelType model_type,
147 const std::string& client_tag, 147 const std::string& client_tag,
148 int64 parent_id) { 148 int64 parent_id) {
149 WriteTransaction trans(FROM_HERE, share); 149 WriteTransaction trans(FROM_HERE, share);
150 ReadNode parent_node(&trans); 150 ReadNode parent_node(&trans);
151 EXPECT_EQ(BaseNode::INIT_OK, parent_node.InitByIdLookup(parent_id)); 151 EXPECT_EQ(BaseNode::INIT_OK, parent_node.InitByIdLookup(parent_id));
152 WriteNode node(&trans); 152 WriteNode node(&trans);
153 csync::WriteNode::InitUniqueByCreationResult result = 153 syncer::WriteNode::InitUniqueByCreationResult result =
154 node.InitUniqueByCreation(model_type, parent_node, client_tag); 154 node.InitUniqueByCreation(model_type, parent_node, client_tag);
155 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 155 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
156 node.SetIsFolder(false); 156 node.SetIsFolder(false);
157 return node.GetId(); 157 return node.GetId();
158 } 158 }
159 159
160 // Makes a folder child of a non-root node. Returns the id of the 160 // Makes a folder child of a non-root node. Returns the id of the
161 // newly-created node. 161 // newly-created node.
162 int64 MakeFolderWithParent(UserShare* share, 162 int64 MakeFolderWithParent(UserShare* share,
163 ModelType model_type, 163 ModelType model_type,
164 int64 parent_id, 164 int64 parent_id,
165 BaseNode* predecessor) { 165 BaseNode* predecessor) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 virtual void SetUp() { 238 virtual void SetUp() {
239 test_user_share_.SetUp(); 239 test_user_share_.SetUp();
240 } 240 }
241 241
242 virtual void TearDown() { 242 virtual void TearDown() {
243 test_user_share_.TearDown(); 243 test_user_share_.TearDown();
244 } 244 }
245 245
246 protected: 246 protected:
247 MessageLoop message_loop_; 247 MessageLoop message_loop_;
248 csync::TestUserShare test_user_share_; 248 syncer::TestUserShare test_user_share_;
249 }; 249 };
250 250
251 TEST_F(SyncApiTest, SanityCheckTest) { 251 TEST_F(SyncApiTest, SanityCheckTest) {
252 { 252 {
253 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 253 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
254 EXPECT_TRUE(trans.GetWrappedTrans() != NULL); 254 EXPECT_TRUE(trans.GetWrappedTrans() != NULL);
255 } 255 }
256 { 256 {
257 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 257 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
258 EXPECT_TRUE(trans.GetWrappedTrans() != NULL); 258 EXPECT_TRUE(trans.GetWrappedTrans() != NULL);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 ReadNode root_node(&trans); 374 ReadNode root_node(&trans);
375 root_node.InitByRootLookup(); 375 root_node.InitByRootLookup();
376 376
377 // we'll use this spare folder later 377 // we'll use this spare folder later
378 WriteNode folder_node(&trans); 378 WriteNode folder_node(&trans);
379 EXPECT_TRUE(folder_node.InitByCreation(syncable::BOOKMARKS, 379 EXPECT_TRUE(folder_node.InitByCreation(syncable::BOOKMARKS,
380 root_node, NULL)); 380 root_node, NULL));
381 folder_id = folder_node.GetId(); 381 folder_id = folder_node.GetId();
382 382
383 WriteNode wnode(&trans); 383 WriteNode wnode(&trans);
384 csync::WriteNode::InitUniqueByCreationResult result = 384 syncer::WriteNode::InitUniqueByCreationResult result =
385 wnode.InitUniqueByCreation(syncable::BOOKMARKS, root_node, "testtag"); 385 wnode.InitUniqueByCreation(syncable::BOOKMARKS, root_node, "testtag");
386 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 386 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
387 wnode.SetIsFolder(false); 387 wnode.SetIsFolder(false);
388 wnode.SetTitle(UTF8ToWide(test_title)); 388 wnode.SetTitle(UTF8ToWide(test_title));
389 389
390 node_id = wnode.GetId(); 390 node_id = wnode.GetId();
391 } 391 }
392 392
393 // Ensure we can delete something with a tag. 393 // Ensure we can delete something with a tag.
394 { 394 {
395 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 395 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
396 WriteNode wnode(&trans); 396 WriteNode wnode(&trans);
(...skipping 19 matching lines...) Expand all
416 EXPECT_EQ(node.GetTitle(), test_title); 416 EXPECT_EQ(node.GetTitle(), test_title);
417 } 417 }
418 418
419 { 419 {
420 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 420 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
421 ReadNode folder_node(&trans); 421 ReadNode folder_node(&trans);
422 EXPECT_EQ(BaseNode::INIT_OK, folder_node.InitByIdLookup(folder_id)); 422 EXPECT_EQ(BaseNode::INIT_OK, folder_node.InitByIdLookup(folder_id));
423 423
424 WriteNode wnode(&trans); 424 WriteNode wnode(&trans);
425 // This will undelete the tag. 425 // This will undelete the tag.
426 csync::WriteNode::InitUniqueByCreationResult result = 426 syncer::WriteNode::InitUniqueByCreationResult result =
427 wnode.InitUniqueByCreation(syncable::BOOKMARKS, folder_node, "testtag"); 427 wnode.InitUniqueByCreation(syncable::BOOKMARKS, folder_node, "testtag");
428 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 428 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
429 EXPECT_EQ(wnode.GetIsFolder(), false); 429 EXPECT_EQ(wnode.GetIsFolder(), false);
430 EXPECT_EQ(wnode.GetParentId(), folder_node.GetId()); 430 EXPECT_EQ(wnode.GetParentId(), folder_node.GetId());
431 EXPECT_EQ(wnode.GetId(), node_id); 431 EXPECT_EQ(wnode.GetId(), node_id);
432 EXPECT_NE(wnode.GetTitle(), test_title); // Title should be cleared 432 EXPECT_NE(wnode.GetTitle(), test_title); // Title should be cleared
433 wnode.SetTitle(UTF8ToWide(test_title)); 433 wnode.SetTitle(UTF8ToWide(test_title));
434 } 434 }
435 435
436 // Now look up should work. 436 // Now look up should work.
437 { 437 {
438 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 438 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
(...skipping 11 matching lines...) Expand all
450 { 450 {
451 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 451 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
452 trans.GetCryptographer()->AddKey(params); 452 trans.GetCryptographer()->AddKey(params);
453 } 453 }
454 { 454 {
455 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 455 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
456 ReadNode root_node(&trans); 456 ReadNode root_node(&trans);
457 root_node.InitByRootLookup(); 457 root_node.InitByRootLookup();
458 458
459 WriteNode password_node(&trans); 459 WriteNode password_node(&trans);
460 csync::WriteNode::InitUniqueByCreationResult result = 460 syncer::WriteNode::InitUniqueByCreationResult result =
461 password_node.InitUniqueByCreation(syncable::PASSWORDS, 461 password_node.InitUniqueByCreation(syncable::PASSWORDS,
462 root_node, "foo"); 462 root_node, "foo");
463 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 463 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
464 sync_pb::PasswordSpecificsData data; 464 sync_pb::PasswordSpecificsData data;
465 data.set_password_value("secret"); 465 data.set_password_value("secret");
466 password_node.SetPasswordSpecifics(data); 466 password_node.SetPasswordSpecifics(data);
467 } 467 }
468 { 468 {
469 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 469 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
470 ReadNode root_node(&trans); 470 ReadNode root_node(&trans);
471 root_node.InitByRootLookup(); 471 root_node.InitByRootLookup();
472 472
473 ReadNode password_node(&trans); 473 ReadNode password_node(&trans);
(...skipping 12 matching lines...) Expand all
486 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 486 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
487 trans.GetCryptographer()->AddKey(params); 487 trans.GetCryptographer()->AddKey(params);
488 trans.GetCryptographer()->set_encrypt_everything(); 488 trans.GetCryptographer()->set_encrypt_everything();
489 } 489 }
490 { 490 {
491 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 491 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
492 ReadNode root_node(&trans); 492 ReadNode root_node(&trans);
493 root_node.InitByRootLookup(); 493 root_node.InitByRootLookup();
494 494
495 WriteNode bookmark_node(&trans); 495 WriteNode bookmark_node(&trans);
496 csync::WriteNode::InitUniqueByCreationResult result = 496 syncer::WriteNode::InitUniqueByCreationResult result =
497 bookmark_node.InitUniqueByCreation(syncable::BOOKMARKS, 497 bookmark_node.InitUniqueByCreation(syncable::BOOKMARKS,
498 root_node, "foo"); 498 root_node, "foo");
499 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 499 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
500 bookmark_node.SetTitle(UTF8ToWide("foo")); 500 bookmark_node.SetTitle(UTF8ToWide("foo"));
501 501
502 WriteNode pref_node(&trans); 502 WriteNode pref_node(&trans);
503 result = 503 result =
504 pref_node.InitUniqueByCreation(syncable::PREFERENCES, root_node, "bar"); 504 pref_node.InitUniqueByCreation(syncable::PREFERENCES, root_node, "bar");
505 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 505 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
506 pref_node.SetTitle(UTF8ToWide("bar")); 506 pref_node.SetTitle(UTF8ToWide("bar"));
507 } 507 }
508 { 508 {
509 ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); 509 ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
510 ReadNode root_node(&trans); 510 ReadNode root_node(&trans);
511 root_node.InitByRootLookup(); 511 root_node.InitByRootLookup();
512 512
513 ReadNode bookmark_node(&trans); 513 ReadNode bookmark_node(&trans);
514 EXPECT_EQ(BaseNode::INIT_OK, 514 EXPECT_EQ(BaseNode::INIT_OK,
515 bookmark_node.InitByClientTagLookup(syncable::BOOKMARKS, 515 bookmark_node.InitByClientTagLookup(syncable::BOOKMARKS,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 ADD_FAILURE(); 633 ADD_FAILURE();
634 } 634 }
635 } 635 }
636 636
637 TEST_F(SyncApiTest, EmptyTags) { 637 TEST_F(SyncApiTest, EmptyTags) {
638 WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); 638 WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
639 ReadNode root_node(&trans); 639 ReadNode root_node(&trans);
640 root_node.InitByRootLookup(); 640 root_node.InitByRootLookup();
641 WriteNode node(&trans); 641 WriteNode node(&trans);
642 std::string empty_tag; 642 std::string empty_tag;
643 csync::WriteNode::InitUniqueByCreationResult result = 643 syncer::WriteNode::InitUniqueByCreationResult result =
644 node.InitUniqueByCreation(syncable::TYPED_URLS, root_node, empty_tag); 644 node.InitUniqueByCreation(syncable::TYPED_URLS, root_node, empty_tag);
645 EXPECT_NE(csync::WriteNode::INIT_SUCCESS, result); 645 EXPECT_NE(syncer::WriteNode::INIT_SUCCESS, result);
646 EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION, 646 EXPECT_EQ(BaseNode::INIT_FAILED_PRECONDITION,
647 node.InitByTagLookup(empty_tag)); 647 node.InitByTagLookup(empty_tag));
648 } 648 }
649 649
650 namespace { 650 namespace {
651 651
652 class TestHttpPostProviderInterface : public HttpPostProviderInterface { 652 class TestHttpPostProviderInterface : public HttpPostProviderInterface {
653 public: 653 public:
654 virtual ~TestHttpPostProviderInterface() {} 654 virtual ~TestHttpPostProviderInterface() {}
655 655
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 }; 687 };
688 688
689 class SyncManagerObserverMock : public SyncManager::Observer { 689 class SyncManagerObserverMock : public SyncManager::Observer {
690 public: 690 public:
691 MOCK_METHOD1(OnSyncCycleCompleted, 691 MOCK_METHOD1(OnSyncCycleCompleted,
692 void(const SyncSessionSnapshot&)); // NOLINT 692 void(const SyncSessionSnapshot&)); // NOLINT
693 MOCK_METHOD2(OnInitializationComplete, 693 MOCK_METHOD2(OnInitializationComplete,
694 void(const WeakHandle<JsBackend>&, bool)); // NOLINT 694 void(const WeakHandle<JsBackend>&, bool)); // NOLINT
695 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT 695 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT
696 MOCK_METHOD2(OnPassphraseRequired, 696 MOCK_METHOD2(OnPassphraseRequired,
697 void(csync::PassphraseRequiredReason, 697 void(syncer::PassphraseRequiredReason,
698 const sync_pb::EncryptedData&)); // NOLINT 698 const sync_pb::EncryptedData&)); // NOLINT
699 MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT 699 MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT
700 MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT 700 MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT
701 MOCK_METHOD0(OnStopSyncingPermanently, void()); // NOLINT 701 MOCK_METHOD0(OnStopSyncingPermanently, void()); // NOLINT
702 MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT 702 MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT
703 MOCK_METHOD2(OnEncryptedTypesChanged, 703 MOCK_METHOD2(OnEncryptedTypesChanged,
704 void(ModelTypeSet, bool)); // NOLINT 704 void(ModelTypeSet, bool)); // NOLINT
705 MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT 705 MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT
706 MOCK_METHOD1(OnActionableError, 706 MOCK_METHOD1(OnActionableError,
707 void(const csync::SyncProtocolError&)); // NOLINT 707 void(const syncer::SyncProtocolError&)); // NOLINT
708 }; 708 };
709 709
710 class SyncNotifierMock : public csync::SyncNotifier { 710 class SyncNotifierMock : public syncer::SyncNotifier {
711 public: 711 public:
712 MOCK_METHOD1(AddObserver, void(csync::SyncNotifierObserver*)); 712 MOCK_METHOD1(AddObserver, void(syncer::SyncNotifierObserver*));
713 MOCK_METHOD1(RemoveObserver, void(csync::SyncNotifierObserver*)); 713 MOCK_METHOD1(RemoveObserver, void(syncer::SyncNotifierObserver*));
714 MOCK_METHOD1(SetUniqueId, void(const std::string&)); 714 MOCK_METHOD1(SetUniqueId, void(const std::string&));
715 MOCK_METHOD1(SetStateDeprecated, void(const std::string&)); 715 MOCK_METHOD1(SetStateDeprecated, void(const std::string&));
716 MOCK_METHOD2(UpdateCredentials, 716 MOCK_METHOD2(UpdateCredentials,
717 void(const std::string&, const std::string&)); 717 void(const std::string&, const std::string&));
718 MOCK_METHOD1(UpdateEnabledTypes, 718 MOCK_METHOD1(UpdateEnabledTypes,
719 void(syncable::ModelTypeSet)); 719 void(syncable::ModelTypeSet));
720 MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet)); 720 MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet));
721 }; 721 };
722 722
723 } // namespace 723 } // namespace
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 780
781 // Takes ownership of |sync_notifier_mock_|. 781 // Takes ownership of |sync_notifier_mock_|.
782 sync_manager_.Init(temp_dir_.path(), 782 sync_manager_.Init(temp_dir_.path(),
783 WeakHandle<JsEventHandler>(), 783 WeakHandle<JsEventHandler>(),
784 "bogus", 0, false, 784 "bogus", 0, false,
785 base::MessageLoopProxy::current(), 785 base::MessageLoopProxy::current(),
786 new TestHttpPostProviderFactory(), routing_info, workers, 786 new TestHttpPostProviderFactory(), routing_info, workers,
787 &extensions_activity_monitor_, this, 787 &extensions_activity_monitor_, this,
788 credentials, 788 credentials,
789 sync_notifier_mock_, "", 789 sync_notifier_mock_, "",
790 csync::SyncManager::TEST_IN_MEMORY, 790 syncer::SyncManager::TEST_IN_MEMORY,
791 &encryptor_, 791 &encryptor_,
792 &handler_, 792 &handler_,
793 NULL); 793 NULL);
794 794
795 EXPECT_TRUE(sync_notifier_observer_); 795 EXPECT_TRUE(sync_notifier_observer_);
796 EXPECT_TRUE(js_backend_.IsInitialized()); 796 EXPECT_TRUE(js_backend_.IsInitialized());
797 797
798 EXPECT_EQ(0, update_enabled_types_call_count_); 798 EXPECT_EQ(0, update_enabled_types_call_count_);
799 799
800 for (ModelSafeRoutingInfo::iterator i = routing_info.begin(); 800 for (ModelSafeRoutingInfo::iterator i = routing_info.begin();
801 i != routing_info.end(); ++i) { 801 i != routing_info.end(); ++i) {
802 type_roots_[i->first] = MakeServerNodeForType( 802 type_roots_[i->first] = MakeServerNodeForType(
803 sync_manager_.GetUserShare(), i->first); 803 sync_manager_.GetUserShare(), i->first);
804 } 804 }
805 PumpLoop(); 805 PumpLoop();
806 } 806 }
807 807
808 void TearDown() { 808 void TearDown() {
809 sync_manager_.RemoveObserver(&observer_); 809 sync_manager_.RemoveObserver(&observer_);
810 sync_manager_.ShutdownOnSyncThread(); 810 sync_manager_.ShutdownOnSyncThread();
811 sync_notifier_mock_ = NULL; 811 sync_notifier_mock_ = NULL;
812 EXPECT_FALSE(sync_notifier_observer_); 812 EXPECT_FALSE(sync_notifier_observer_);
813 PumpLoop(); 813 PumpLoop();
814 } 814 }
815 815
816 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 816 void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
817 (*out)[syncable::NIGORI] = csync::GROUP_PASSIVE; 817 (*out)[syncable::NIGORI] = syncer::GROUP_PASSIVE;
818 (*out)[syncable::BOOKMARKS] = csync::GROUP_PASSIVE; 818 (*out)[syncable::BOOKMARKS] = syncer::GROUP_PASSIVE;
819 (*out)[syncable::THEMES] = csync::GROUP_PASSIVE; 819 (*out)[syncable::THEMES] = syncer::GROUP_PASSIVE;
820 (*out)[syncable::SESSIONS] = csync::GROUP_PASSIVE; 820 (*out)[syncable::SESSIONS] = syncer::GROUP_PASSIVE;
821 (*out)[syncable::PASSWORDS] = csync::GROUP_PASSIVE; 821 (*out)[syncable::PASSWORDS] = syncer::GROUP_PASSIVE;
822 (*out)[syncable::PREFERENCES] = csync::GROUP_PASSIVE; 822 (*out)[syncable::PREFERENCES] = syncer::GROUP_PASSIVE;
823 } 823 }
824 824
825 virtual void OnChangesApplied( 825 virtual void OnChangesApplied(
826 syncable::ModelType model_type, 826 syncable::ModelType model_type,
827 const BaseTransaction* trans, 827 const BaseTransaction* trans,
828 const ImmutableChangeRecordList& changes) OVERRIDE {} 828 const ImmutableChangeRecordList& changes) OVERRIDE {}
829 829
830 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE {} 830 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE {}
831 831
832 // Helper methods. 832 // Helper methods.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 return cryptographer->is_ready(); 864 return cryptographer->is_ready();
865 } 865 }
866 866
867 int64 GetIdForDataType(ModelType type) { 867 int64 GetIdForDataType(ModelType type) {
868 if (type_roots_.count(type) == 0) 868 if (type_roots_.count(type) == 0)
869 return 0; 869 return 0;
870 return type_roots_[type]; 870 return type_roots_[type];
871 } 871 }
872 872
873 void SyncNotifierAddObserver( 873 void SyncNotifierAddObserver(
874 csync::SyncNotifierObserver* sync_notifier_observer) { 874 syncer::SyncNotifierObserver* sync_notifier_observer) {
875 EXPECT_EQ(NULL, sync_notifier_observer_); 875 EXPECT_EQ(NULL, sync_notifier_observer_);
876 sync_notifier_observer_ = sync_notifier_observer; 876 sync_notifier_observer_ = sync_notifier_observer;
877 } 877 }
878 878
879 void SyncNotifierRemoveObserver( 879 void SyncNotifierRemoveObserver(
880 csync::SyncNotifierObserver* sync_notifier_observer) { 880 syncer::SyncNotifierObserver* sync_notifier_observer) {
881 EXPECT_EQ(sync_notifier_observer_, sync_notifier_observer); 881 EXPECT_EQ(sync_notifier_observer_, sync_notifier_observer);
882 sync_notifier_observer_ = NULL; 882 sync_notifier_observer_ = NULL;
883 } 883 }
884 884
885 void SyncNotifierUpdateEnabledTypes(syncable::ModelTypeSet types) { 885 void SyncNotifierUpdateEnabledTypes(syncable::ModelTypeSet types) {
886 ModelSafeRoutingInfo routes; 886 ModelSafeRoutingInfo routes;
887 GetModelSafeRoutingInfo(&routes); 887 GetModelSafeRoutingInfo(&routes);
888 const syncable::ModelTypeSet expected_types = 888 const syncable::ModelTypeSet expected_types =
889 GetRoutingInfoTypes(routes); 889 GetRoutingInfoTypes(routes);
890 EXPECT_TRUE(types.Equals(expected_types)); 890 EXPECT_TRUE(types.Equals(expected_types));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 std::map<ModelType, int64> type_roots_; 935 std::map<ModelType, int64> type_roots_;
936 FakeExtensionsActivityMonitor extensions_activity_monitor_; 936 FakeExtensionsActivityMonitor extensions_activity_monitor_;
937 StrictMock<SyncNotifierMock>* sync_notifier_mock_; 937 StrictMock<SyncNotifierMock>* sync_notifier_mock_;
938 938
939 protected: 939 protected:
940 FakeEncryptor encryptor_; 940 FakeEncryptor encryptor_;
941 TestUnrecoverableErrorHandler handler_; 941 TestUnrecoverableErrorHandler handler_;
942 SyncManager sync_manager_; 942 SyncManager sync_manager_;
943 WeakHandle<JsBackend> js_backend_; 943 WeakHandle<JsBackend> js_backend_;
944 StrictMock<SyncManagerObserverMock> observer_; 944 StrictMock<SyncManagerObserverMock> observer_;
945 csync::SyncNotifierObserver* sync_notifier_observer_; 945 syncer::SyncNotifierObserver* sync_notifier_observer_;
946 int update_enabled_types_call_count_; 946 int update_enabled_types_call_count_;
947 }; 947 };
948 948
949 TEST_F(SyncManagerTest, UpdateEnabledTypes) { 949 TEST_F(SyncManagerTest, UpdateEnabledTypes) {
950 EXPECT_EQ(0, update_enabled_types_call_count_); 950 EXPECT_EQ(0, update_enabled_types_call_count_);
951 951
952 ModelSafeRoutingInfo routes; 952 ModelSafeRoutingInfo routes;
953 GetModelSafeRoutingInfo(&routes); 953 GetModelSafeRoutingInfo(&routes);
954 const syncable::ModelTypeSet enabled_types = 954 const syncable::ModelTypeSet enabled_types =
955 GetRoutingInfoTypes(routes); 955 GetRoutingInfoTypes(routes);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 1259
1260 EXPECT_CALL(event_handler, 1260 EXPECT_CALL(event_handler,
1261 HandleJsEvent("onNotificationStateChange", 1261 HandleJsEvent("onNotificationStateChange",
1262 HasDetailsAsDictionary(true_details))); 1262 HasDetailsAsDictionary(true_details)));
1263 EXPECT_CALL(event_handler, 1263 EXPECT_CALL(event_handler,
1264 HandleJsEvent("onNotificationStateChange", 1264 HandleJsEvent("onNotificationStateChange",
1265 HasDetailsAsDictionary(false_details))); 1265 HasDetailsAsDictionary(false_details)));
1266 1266
1267 sync_manager_.SimulateEnableNotificationsForTest(); 1267 sync_manager_.SimulateEnableNotificationsForTest();
1268 sync_manager_.SimulateDisableNotificationsForTest( 1268 sync_manager_.SimulateDisableNotificationsForTest(
1269 csync::TRANSIENT_NOTIFICATION_ERROR); 1269 syncer::TRANSIENT_NOTIFICATION_ERROR);
1270 1270
1271 SetJsEventHandler(event_handler.AsWeakHandle()); 1271 SetJsEventHandler(event_handler.AsWeakHandle());
1272 sync_manager_.SimulateEnableNotificationsForTest(); 1272 sync_manager_.SimulateEnableNotificationsForTest();
1273 sync_manager_.SimulateDisableNotificationsForTest( 1273 sync_manager_.SimulateDisableNotificationsForTest(
1274 csync::TRANSIENT_NOTIFICATION_ERROR); 1274 syncer::TRANSIENT_NOTIFICATION_ERROR);
1275 SetJsEventHandler(WeakHandle<JsEventHandler>()); 1275 SetJsEventHandler(WeakHandle<JsEventHandler>());
1276 1276
1277 sync_manager_.SimulateEnableNotificationsForTest(); 1277 sync_manager_.SimulateEnableNotificationsForTest();
1278 sync_manager_.SimulateDisableNotificationsForTest( 1278 sync_manager_.SimulateDisableNotificationsForTest(
1279 csync::TRANSIENT_NOTIFICATION_ERROR); 1279 syncer::TRANSIENT_NOTIFICATION_ERROR);
1280 1280
1281 // Should trigger the replies. 1281 // Should trigger the replies.
1282 PumpLoop(); 1282 PumpLoop();
1283 } 1283 }
1284 1284
1285 TEST_F(SyncManagerTest, OnIncomingNotification) { 1285 TEST_F(SyncManagerTest, OnIncomingNotification) {
1286 StrictMock<MockJsEventHandler> event_handler; 1286 StrictMock<MockJsEventHandler> event_handler;
1287 1287
1288 const syncable::ModelTypeSet empty_model_types; 1288 const syncable::ModelTypeSet empty_model_types;
1289 const syncable::ModelTypeSet model_types( 1289 const syncable::ModelTypeSet model_types(
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 // Store the default (soon to be old) key. 1570 // Store the default (soon to be old) key.
1571 Cryptographer* cryptographer = trans.GetCryptographer(); 1571 Cryptographer* cryptographer = trans.GetCryptographer();
1572 std::string bootstrap_token; 1572 std::string bootstrap_token;
1573 cryptographer->GetBootstrapToken(&bootstrap_token); 1573 cryptographer->GetBootstrapToken(&bootstrap_token);
1574 verifier.Bootstrap(bootstrap_token); 1574 verifier.Bootstrap(bootstrap_token);
1575 1575
1576 ReadNode root_node(&trans); 1576 ReadNode root_node(&trans);
1577 root_node.InitByRootLookup(); 1577 root_node.InitByRootLookup();
1578 1578
1579 WriteNode password_node(&trans); 1579 WriteNode password_node(&trans);
1580 csync::WriteNode::InitUniqueByCreationResult result = 1580 syncer::WriteNode::InitUniqueByCreationResult result =
1581 password_node.InitUniqueByCreation(syncable::PASSWORDS, 1581 password_node.InitUniqueByCreation(syncable::PASSWORDS,
1582 root_node, "foo"); 1582 root_node, "foo");
1583 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 1583 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
1584 sync_pb::PasswordSpecificsData data; 1584 sync_pb::PasswordSpecificsData data;
1585 data.set_password_value("secret"); 1585 data.set_password_value("secret");
1586 password_node.SetPasswordSpecifics(data); 1586 password_node.SetPasswordSpecifics(data);
1587 } 1587 }
1588 EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_)); 1588 EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_));
1589 EXPECT_CALL(observer_, OnPassphraseAccepted()); 1589 EXPECT_CALL(observer_, OnPassphraseAccepted());
1590 EXPECT_CALL(observer_, OnEncryptionComplete()); 1590 EXPECT_CALL(observer_, OnEncryptionComplete());
1591 sync_manager_.SetEncryptionPassphrase("new_passphrase", true); 1591 sync_manager_.SetEncryptionPassphrase("new_passphrase", true);
1592 EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); 1592 EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest());
1593 { 1593 {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) { 1804 TEST_F(SyncManagerTest, SetPassphraseWithEmptyPasswordNode) {
1805 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); 1805 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
1806 int64 node_id = 0; 1806 int64 node_id = 0;
1807 std::string tag = "foo"; 1807 std::string tag = "foo";
1808 { 1808 {
1809 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 1809 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
1810 ReadNode root_node(&trans); 1810 ReadNode root_node(&trans);
1811 root_node.InitByRootLookup(); 1811 root_node.InitByRootLookup();
1812 1812
1813 WriteNode password_node(&trans); 1813 WriteNode password_node(&trans);
1814 csync::WriteNode::InitUniqueByCreationResult result = 1814 syncer::WriteNode::InitUniqueByCreationResult result =
1815 password_node.InitUniqueByCreation(syncable::PASSWORDS, root_node, tag); 1815 password_node.InitUniqueByCreation(syncable::PASSWORDS, root_node, tag);
1816 EXPECT_EQ(csync::WriteNode::INIT_SUCCESS, result); 1816 EXPECT_EQ(syncer::WriteNode::INIT_SUCCESS, result);
1817 node_id = password_node.GetId(); 1817 node_id = password_node.GetId();
1818 } 1818 }
1819 EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_)); 1819 EXPECT_CALL(observer_, OnBootstrapTokenUpdated(_));
1820 EXPECT_CALL(observer_, OnPassphraseAccepted()); 1820 EXPECT_CALL(observer_, OnPassphraseAccepted());
1821 EXPECT_CALL(observer_, OnEncryptionComplete()); 1821 EXPECT_CALL(observer_, OnEncryptionComplete());
1822 sync_manager_.SetEncryptionPassphrase("new_passphrase", true); 1822 sync_manager_.SetEncryptionPassphrase("new_passphrase", true);
1823 EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest()); 1823 EXPECT_FALSE(sync_manager_.EncryptEverythingEnabledForTest());
1824 { 1824 {
1825 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 1825 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
1826 ReadNode password_node(&trans); 1826 ReadNode password_node(&trans);
1827 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY, 1827 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY,
1828 password_node.InitByClientTagLookup(syncable::PASSWORDS, 1828 password_node.InitByClientTagLookup(syncable::PASSWORDS,
1829 tag)); 1829 tag));
1830 } 1830 }
1831 { 1831 {
1832 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 1832 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
1833 ReadNode password_node(&trans); 1833 ReadNode password_node(&trans);
1834 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY, 1834 EXPECT_EQ(BaseNode::INIT_FAILED_DECRYPT_IF_NECESSARY,
1835 password_node.InitByIdLookup(node_id)); 1835 password_node.InitByIdLookup(node_id));
1836 } 1836 }
1837 } 1837 }
1838 1838
1839 TEST_F(SyncManagerTest, NudgeDelayTest) { 1839 TEST_F(SyncManagerTest, NudgeDelayTest) {
1840 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::BOOKMARKS), 1840 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::BOOKMARKS),
1841 base::TimeDelta::FromMilliseconds( 1841 base::TimeDelta::FromMilliseconds(
1842 SyncManager::kDefaultNudgeDelayMilliseconds)); 1842 SyncManager::kDefaultNudgeDelayMilliseconds));
1843 1843
1844 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::AUTOFILL), 1844 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::AUTOFILL),
1845 base::TimeDelta::FromSeconds( 1845 base::TimeDelta::FromSeconds(
1846 csync::kDefaultShortPollIntervalSeconds)); 1846 syncer::kDefaultShortPollIntervalSeconds));
1847 1847
1848 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::PREFERENCES), 1848 EXPECT_EQ(sync_manager_.GetNudgeDelayTimeDelta(syncable::PREFERENCES),
1849 base::TimeDelta::FromMilliseconds( 1849 base::TimeDelta::FromMilliseconds(
1850 SyncManager::kPreferencesNudgeDelayMilliseconds)); 1850 SyncManager::kPreferencesNudgeDelayMilliseconds));
1851 } 1851 }
1852 1852
1853 // Friended by WriteNode, so can't be in an anonymouse namespace. 1853 // Friended by WriteNode, so can't be in an anonymouse namespace.
1854 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) { 1854 TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
1855 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); 1855 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
1856 std::string title; 1856 std::string title;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
2455 // the data. 2455 // the data.
2456 TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) { 2456 TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
2457 std::string client_tag = "tag"; 2457 std::string client_tag = "tag";
2458 std::string url = "url"; 2458 std::string url = "url";
2459 std::string url2 = "new_url"; 2459 std::string url2 = "new_url";
2460 std::string title = "title"; 2460 std::string title = "title";
2461 sync_pb::EntitySpecifics entity_specifics; 2461 sync_pb::EntitySpecifics entity_specifics;
2462 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION)); 2462 EXPECT_TRUE(SetUpEncryption(WRITE_TO_NIGORI, DEFAULT_ENCRYPTION));
2463 { 2463 {
2464 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2464 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2465 csync::Cryptographer* crypto = trans.GetCryptographer(); 2465 syncer::Cryptographer* crypto = trans.GetCryptographer();
2466 sync_pb::EntitySpecifics bm_specifics; 2466 sync_pb::EntitySpecifics bm_specifics;
2467 bm_specifics.mutable_bookmark()->set_title("title"); 2467 bm_specifics.mutable_bookmark()->set_title("title");
2468 bm_specifics.mutable_bookmark()->set_url("url"); 2468 bm_specifics.mutable_bookmark()->set_url("url");
2469 sync_pb::EncryptedData encrypted; 2469 sync_pb::EncryptedData encrypted;
2470 crypto->Encrypt(bm_specifics, &encrypted); 2470 crypto->Encrypt(bm_specifics, &encrypted);
2471 entity_specifics.mutable_encrypted()->CopyFrom(encrypted); 2471 entity_specifics.mutable_encrypted()->CopyFrom(encrypted);
2472 syncable::AddDefaultFieldValue(syncable::BOOKMARKS, &entity_specifics); 2472 syncable::AddDefaultFieldValue(syncable::BOOKMARKS, &entity_specifics);
2473 } 2473 }
2474 MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag, 2474 MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag,
2475 BaseNode::GenerateSyncableHash(syncable::BOOKMARKS, 2475 BaseNode::GenerateSyncableHash(syncable::BOOKMARKS,
(...skipping 27 matching lines...) Expand all
2503 node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag)); 2503 node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag));
2504 EXPECT_EQ(title, node.GetTitle()); 2504 EXPECT_EQ(title, node.GetTitle());
2505 EXPECT_EQ(GURL(url2), node.GetURL()); 2505 EXPECT_EQ(GURL(url2), node.GetURL());
2506 const syncable::Entry* node_entry = node.GetEntry(); 2506 const syncable::Entry* node_entry = node.GetEntry();
2507 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); 2507 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
2508 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); 2508 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
2509 EXPECT_TRUE(specifics.has_encrypted()); 2509 EXPECT_TRUE(specifics.has_encrypted());
2510 } 2510 }
2511 } 2511 }
2512 2512
2513 } // namespace csync 2513 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/syncapi_server_connection_manager_unittest.cc ('k') | sync/internal_api/test/test_entry_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698