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 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 CheckBool(dictionary, "encryptAllData", false); | 792 CheckBool(dictionary, "encryptAllData", false); |
793 CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); | 793 CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); |
794 } | 794 } |
795 | 795 |
796 TEST_F(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { | 796 TEST_F(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { |
797 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 797 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
798 .WillRepeatedly(Return(false)); | 798 .WillRepeatedly(Return(false)); |
799 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) | 799 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
800 .WillRepeatedly(Return(false)); | 800 .WillRepeatedly(Return(false)); |
801 SetupInitializedProfileSyncService(); | 801 SetupInitializedProfileSyncService(); |
802 sync_driver::SyncPrefs sync_prefs(profile_->GetPrefs()); | 802 syncer::SyncPrefs sync_prefs(profile_->GetPrefs()); |
803 sync_prefs.SetKeepEverythingSynced(false); | 803 sync_prefs.SetKeepEverythingSynced(false); |
804 SetDefaultExpectationsForConfigPage(); | 804 SetDefaultExpectationsForConfigPage(); |
805 // This should display the sync setup dialog (not login). | 805 // This should display the sync setup dialog (not login). |
806 handler_->OpenSyncSetup(false /* creating_supervised_user */); | 806 handler_->OpenSyncSetup(false /* creating_supervised_user */); |
807 | 807 |
808 ExpectConfig(); | 808 ExpectConfig(); |
809 const content::TestWebUI::CallData& data = *web_ui_.call_data()[0]; | 809 const content::TestWebUI::CallData& data = *web_ui_.call_data()[0]; |
810 const base::DictionaryValue* dictionary = nullptr; | 810 const base::DictionaryValue* dictionary = nullptr; |
811 ASSERT_TRUE(data.arg2()->GetAsDictionary(&dictionary)); | 811 ASSERT_TRUE(data.arg2()->GetAsDictionary(&dictionary)); |
812 CheckConfigDataTypeArguments(dictionary, CHOOSE_WHAT_TO_SYNC, GetAllTypes()); | 812 CheckConfigDataTypeArguments(dictionary, CHOOSE_WHAT_TO_SYNC, GetAllTypes()); |
813 } | 813 } |
814 | 814 |
815 TEST_F(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { | 815 TEST_F(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { |
816 syncer::ModelTypeSet user_selectable_types = GetAllTypes(); | 816 syncer::ModelTypeSet user_selectable_types = GetAllTypes(); |
817 syncer::ModelTypeSet::Iterator it; | 817 syncer::ModelTypeSet::Iterator it; |
818 for (it = user_selectable_types.First(); it.Good(); it.Inc()) { | 818 for (it = user_selectable_types.First(); it.Good(); it.Inc()) { |
819 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 819 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
820 .WillRepeatedly(Return(false)); | 820 .WillRepeatedly(Return(false)); |
821 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) | 821 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
822 .WillRepeatedly(Return(false)); | 822 .WillRepeatedly(Return(false)); |
823 SetupInitializedProfileSyncService(); | 823 SetupInitializedProfileSyncService(); |
824 sync_driver::SyncPrefs sync_prefs(profile_->GetPrefs()); | 824 syncer::SyncPrefs sync_prefs(profile_->GetPrefs()); |
825 sync_prefs.SetKeepEverythingSynced(false); | 825 sync_prefs.SetKeepEverythingSynced(false); |
826 SetDefaultExpectationsForConfigPage(); | 826 SetDefaultExpectationsForConfigPage(); |
827 syncer::ModelTypeSet types; | 827 syncer::ModelTypeSet types; |
828 types.Put(it.Get()); | 828 types.Put(it.Get()); |
829 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). | 829 EXPECT_CALL(*mock_pss_, GetPreferredDataTypes()). |
830 WillRepeatedly(Return(types)); | 830 WillRepeatedly(Return(types)); |
831 | 831 |
832 // This should display the sync setup dialog (not login). | 832 // This should display the sync setup dialog (not login). |
833 handler_->OpenSyncSetup(false /* creating_supervised_user */); | 833 handler_->OpenSyncSetup(false /* creating_supervised_user */); |
834 | 834 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) | 943 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) |
944 .WillRepeatedly(Return(false)); | 944 .WillRepeatedly(Return(false)); |
945 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); | 945 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); |
946 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); | 946 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); |
947 handler_->HandleConfigure(&list_args); | 947 handler_->HandleConfigure(&list_args); |
948 | 948 |
949 // Ensure that we navigated to the "done" state since we don't need a | 949 // Ensure that we navigated to the "done" state since we don't need a |
950 // passphrase. | 950 // passphrase. |
951 ExpectDone(); | 951 ExpectDone(); |
952 } | 952 } |
OLD | NEW |