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

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

Issue 10804039: Make SyncBackendRegistrar aware of loaded data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('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) 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 669 }
670 virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE { 670 virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE {
671 delete static_cast<TestHttpPostProviderInterface*>(http); 671 delete static_cast<TestHttpPostProviderInterface*>(http);
672 } 672 }
673 }; 673 };
674 674
675 class SyncManagerObserverMock : public SyncManager::Observer { 675 class SyncManagerObserverMock : public SyncManager::Observer {
676 public: 676 public:
677 MOCK_METHOD1(OnSyncCycleCompleted, 677 MOCK_METHOD1(OnSyncCycleCompleted,
678 void(const SyncSessionSnapshot&)); // NOLINT 678 void(const SyncSessionSnapshot&)); // NOLINT
679 MOCK_METHOD2(OnInitializationComplete, 679 MOCK_METHOD3(OnInitializationComplete,
680 void(const WeakHandle<JsBackend>&, bool)); // NOLINT 680 void(const WeakHandle<JsBackend>&, bool,
681 syncer::ModelTypeSet)); // NOLINT
681 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT 682 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus)); // NOLINT
682 MOCK_METHOD2(OnPassphraseRequired, 683 MOCK_METHOD2(OnPassphraseRequired,
683 void(PassphraseRequiredReason, 684 void(PassphraseRequiredReason,
684 const sync_pb::EncryptedData&)); // NOLINT 685 const sync_pb::EncryptedData&)); // NOLINT
685 MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT 686 MOCK_METHOD0(OnPassphraseAccepted, void()); // NOLINT
686 MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT 687 MOCK_METHOD1(OnBootstrapTokenUpdated, void(const std::string&)); // NOLINT
687 MOCK_METHOD0(OnStopSyncingPermanently, void()); // NOLINT 688 MOCK_METHOD0(OnStopSyncingPermanently, void()); // NOLINT
688 MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT 689 MOCK_METHOD1(OnUpdatedToken, void(const std::string&)); // NOLINT
689 MOCK_METHOD2(OnEncryptedTypesChanged, 690 MOCK_METHOD2(OnEncryptedTypesChanged,
690 void(ModelTypeSet, bool)); // NOLINT 691 void(ModelTypeSet, bool)); // NOLINT
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 credentials.email = "foo@bar.com"; 737 credentials.email = "foo@bar.com";
737 credentials.sync_token = "sometoken"; 738 credentials.sync_token = "sometoken";
738 739
739 sync_notifier_mock_ = new StrictMock<SyncNotifierMock>(); 740 sync_notifier_mock_ = new StrictMock<SyncNotifierMock>();
740 EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_)); 741 EXPECT_CALL(*sync_notifier_mock_, SetUniqueId(_));
741 EXPECT_CALL(*sync_notifier_mock_, SetStateDeprecated("")); 742 EXPECT_CALL(*sync_notifier_mock_, SetStateDeprecated(""));
742 EXPECT_CALL(*sync_notifier_mock_, 743 EXPECT_CALL(*sync_notifier_mock_,
743 UpdateCredentials(credentials.email, credentials.sync_token)); 744 UpdateCredentials(credentials.email, credentials.sync_token));
744 745
745 sync_manager_.AddObserver(&observer_); 746 sync_manager_.AddObserver(&observer_);
746 EXPECT_CALL(observer_, OnInitializationComplete(_, _)). 747 EXPECT_CALL(observer_, OnInitializationComplete(_, _, _)).
747 WillOnce(SaveArg<0>(&js_backend_)); 748 WillOnce(SaveArg<0>(&js_backend_));
748 749
749 EXPECT_FALSE(js_backend_.IsInitialized()); 750 EXPECT_FALSE(js_backend_.IsInitialized());
750 751
751 std::vector<ModelSafeWorker*> workers; 752 std::vector<ModelSafeWorker*> workers;
752 ModelSafeRoutingInfo routing_info; 753 ModelSafeRoutingInfo routing_info;
753 GetModelSafeRoutingInfo(&routing_info); 754 GetModelSafeRoutingInfo(&routing_info);
754 755
755 // Takes ownership of |sync_notifier_mock_|. 756 // Takes ownership of |sync_notifier_mock_|.
756 sync_manager_.Init(temp_dir_.path(), 757 sync_manager_.Init(temp_dir_.path(),
757 WeakHandle<JsEventHandler>(), 758 WeakHandle<JsEventHandler>(),
758 "bogus", 0, false, 759 "bogus", 0, false,
759 base::MessageLoopProxy::current(), 760 base::MessageLoopProxy::current(),
760 scoped_ptr<HttpPostProviderFactory>( 761 scoped_ptr<HttpPostProviderFactory>(
761 new TestHttpPostProviderFactory()), 762 new TestHttpPostProviderFactory()),
762 routing_info, workers, 763 workers, &extensions_activity_monitor_, this,
763 &extensions_activity_monitor_, this,
764 credentials, 764 credentials,
765 scoped_ptr<SyncNotifier>(sync_notifier_mock_), 765 scoped_ptr<SyncNotifier>(sync_notifier_mock_),
766 "", 766 "",
767 scoped_ptr<InternalComponentsFactory>(GetFactory()), 767 scoped_ptr<InternalComponentsFactory>(GetFactory()),
768 &encryptor_, 768 &encryptor_,
769 &handler_, 769 &handler_,
770 NULL); 770 NULL);
771 771
772 EXPECT_TRUE(js_backend_.IsInitialized()); 772 EXPECT_TRUE(js_backend_.IsInitialized());
773 773
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2621 // Ensure only bookmarks and nigori lost their progress marker. Preferences 2621 // Ensure only bookmarks and nigori lost their progress marker. Preferences
2622 // should still have it. 2622 // should still have it.
2623 partial_types = 2623 partial_types =
2624 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()); 2624 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All());
2625 EXPECT_TRUE(partial_types.Has(NIGORI)); 2625 EXPECT_TRUE(partial_types.Has(NIGORI));
2626 EXPECT_TRUE(partial_types.Has(BOOKMARKS)); 2626 EXPECT_TRUE(partial_types.Has(BOOKMARKS));
2627 EXPECT_FALSE(partial_types.Has(PREFERENCES)); 2627 EXPECT_FALSE(partial_types.Has(PREFERENCES));
2628 } 2628 }
2629 2629
2630 } // namespace 2630 } // namespace
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698