| 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT | 706 MOCK_METHOD0(OnEncryptionComplete, void()); // NOLINT |
| 707 MOCK_METHOD1(OnActionableError, | 707 MOCK_METHOD1(OnActionableError, |
| 708 void(const browser_sync::SyncProtocolError&)); // NOLINT | 708 void(const browser_sync::SyncProtocolError&)); // NOLINT |
| 709 }; | 709 }; |
| 710 | 710 |
| 711 class SyncNotifierMock : public sync_notifier::SyncNotifier { | 711 class SyncNotifierMock : public sync_notifier::SyncNotifier { |
| 712 public: | 712 public: |
| 713 MOCK_METHOD1(AddObserver, void(sync_notifier::SyncNotifierObserver*)); | 713 MOCK_METHOD1(AddObserver, void(sync_notifier::SyncNotifierObserver*)); |
| 714 MOCK_METHOD1(RemoveObserver, void(sync_notifier::SyncNotifierObserver*)); | 714 MOCK_METHOD1(RemoveObserver, void(sync_notifier::SyncNotifierObserver*)); |
| 715 MOCK_METHOD1(SetUniqueId, void(const std::string&)); | 715 MOCK_METHOD1(SetUniqueId, void(const std::string&)); |
| 716 MOCK_METHOD1(SetState, void(const std::string&)); | 716 MOCK_METHOD1(SetStateDeprecated, void(const std::string&)); |
| 717 MOCK_METHOD2(UpdateCredentials, | 717 MOCK_METHOD2(UpdateCredentials, |
| 718 void(const std::string&, const std::string&)); | 718 void(const std::string&, const std::string&)); |
| 719 MOCK_METHOD1(UpdateEnabledTypes, | 719 MOCK_METHOD1(UpdateEnabledTypes, |
| 720 void(syncable::ModelTypeSet)); | 720 void(syncable::ModelTypeSet)); |
| 721 MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet)); | 721 MOCK_METHOD1(SendNotification, void(syncable::ModelTypeSet)); |
| 722 }; | 722 }; |
| 723 | 723 |
| 724 } // namespace | 724 } // namespace |
| 725 | 725 |
| 726 class SyncManagerTest : public testing::Test, | 726 class SyncManagerTest : public testing::Test, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 753 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 753 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 754 | 754 |
| 755 SyncCredentials credentials; | 755 SyncCredentials credentials; |
| 756 credentials.email = "foo@bar.com"; | 756 credentials.email = "foo@bar.com"; |
| 757 credentials.sync_token = "sometoken"; | 757 credentials.sync_token = "sometoken"; |
| 758 | 758 |
| 759 sync_notifier_mock_ = new StrictMock<SyncNotifierMock>(); | 759 sync_notifier_mock_ = new StrictMock<SyncNotifierMock>(); |
| 760 EXPECT_CALL(*sync_notifier_mock_, AddObserver(_)). | 760 EXPECT_CALL(*sync_notifier_mock_, AddObserver(_)). |
| 761 WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierAddObserver)); | 761 WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierAddObserver)); |
| 762 EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_)); | 762 EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_)); |
| 763 EXPECT_CALL(*sync_notifier_mock_, SetState("")); | 763 EXPECT_CALL(*sync_notifier_mock_, SetStateDeprecated("")); |
| 764 EXPECT_CALL(*sync_notifier_mock_, | 764 EXPECT_CALL(*sync_notifier_mock_, |
| 765 UpdateCredentials(credentials.email, credentials.sync_token)); | 765 UpdateCredentials(credentials.email, credentials.sync_token)); |
| 766 EXPECT_CALL(*sync_notifier_mock_, UpdateEnabledTypes(_)). | 766 EXPECT_CALL(*sync_notifier_mock_, UpdateEnabledTypes(_)). |
| 767 Times(AtLeast(1)). | 767 Times(AtLeast(1)). |
| 768 WillRepeatedly( | 768 WillRepeatedly( |
| 769 Invoke(this, &SyncManagerTest::SyncNotifierUpdateEnabledTypes)); | 769 Invoke(this, &SyncManagerTest::SyncNotifierUpdateEnabledTypes)); |
| 770 EXPECT_CALL(*sync_notifier_mock_, RemoveObserver(_)). | 770 EXPECT_CALL(*sync_notifier_mock_, RemoveObserver(_)). |
| 771 WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierRemoveObserver)); | 771 WillOnce(Invoke(this, &SyncManagerTest::SyncNotifierRemoveObserver)); |
| 772 | 772 |
| 773 sync_manager_.AddObserver(&observer_); | 773 sync_manager_.AddObserver(&observer_); |
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 EXPECT_EQ(title, node.GetTitle()); | 2502 EXPECT_EQ(title, node.GetTitle()); |
| 2503 EXPECT_EQ(GURL(url2), node.GetURL()); | 2503 EXPECT_EQ(GURL(url2), node.GetURL()); |
| 2504 const syncable::Entry* node_entry = node.GetEntry(); | 2504 const syncable::Entry* node_entry = node.GetEntry(); |
| 2505 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); | 2505 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); |
| 2506 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); | 2506 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); |
| 2507 EXPECT_TRUE(specifics.has_encrypted()); | 2507 EXPECT_TRUE(specifics.has_encrypted()); |
| 2508 } | 2508 } |
| 2509 } | 2509 } |
| 2510 | 2510 |
| 2511 } // namespace browser_sync | 2511 } // namespace browser_sync |
| OLD | NEW |