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

Side by Side Diff: chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc

Issue 2279713002: Make PassphraseType a "enum class" instead of "enum". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix java Created 4 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
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 #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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 mock_signin_ = static_cast<SigninManagerBase*>( 196 mock_signin_ = static_cast<SigninManagerBase*>(
197 SigninManagerFactory::GetForProfile(profile_.get())); 197 SigninManagerFactory::GetForProfile(profile_.get()));
198 std::string username = GetTestUser(); 198 std::string username = GetTestUser();
199 if (!username.empty()) 199 if (!username.empty())
200 mock_signin_->SetAuthenticatedAccountInfo(username, username); 200 mock_signin_->SetAuthenticatedAccountInfo(username, username);
201 201
202 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 202 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
203 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 203 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
204 profile_.get(), BuildMockProfileSyncService)); 204 profile_.get(), BuildMockProfileSyncService));
205 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); 205 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_));
206 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault( 206 ON_CALL(*mock_pss_, GetPassphraseType())
207 Return(syncer::IMPLICIT_PASSPHRASE)); 207 .WillByDefault(Return(syncer::PassphraseType::IMPLICIT_PASSPHRASE));
208 ON_CALL(*mock_pss_, GetExplicitPassphraseTime()).WillByDefault( 208 ON_CALL(*mock_pss_, GetExplicitPassphraseTime()).WillByDefault(
209 Return(base::Time())); 209 Return(base::Time()));
210 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) 210 ON_CALL(*mock_pss_, GetRegisteredDataTypes())
211 .WillByDefault(Return(syncer::ModelTypeSet())); 211 .WillByDefault(Return(syncer::ModelTypeSet()));
212 212
213 mock_pss_->Initialize(); 213 mock_pss_->Initialize();
214 214
215 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); 215 handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get()));
216 } 216 }
217 217
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 CheckBool(dictionary, "usePassphrase", false); 863 CheckBool(dictionary, "usePassphrase", false);
864 CheckBool(dictionary, "passphraseFailed", false); 864 CheckBool(dictionary, "passphraseFailed", false);
865 } 865 }
866 866
867 TEST_F(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { 867 TEST_F(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) {
868 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) 868 EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
869 .WillRepeatedly(Return(true)); 869 .WillRepeatedly(Return(true));
870 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) 870 EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase())
871 .WillRepeatedly(Return(true)); 871 .WillRepeatedly(Return(true));
872 EXPECT_CALL(*mock_pss_, GetPassphraseType()) 872 EXPECT_CALL(*mock_pss_, GetPassphraseType())
873 .WillRepeatedly(Return(syncer::CUSTOM_PASSPHRASE)); 873 .WillRepeatedly(Return(syncer::PassphraseType::CUSTOM_PASSPHRASE));
874 SetupInitializedProfileSyncService(); 874 SetupInitializedProfileSyncService();
875 SetDefaultExpectationsForConfigPage(); 875 SetDefaultExpectationsForConfigPage();
876 876
877 // This should display the sync setup dialog (not login). 877 // This should display the sync setup dialog (not login).
878 handler_->OpenSyncSetup(false /* creating_supervised_user */); 878 handler_->OpenSyncSetup(false /* creating_supervised_user */);
879 879
880 ExpectConfig(); 880 ExpectConfig();
881 const content::TestWebUI::CallData& data = *web_ui_.call_data()[0]; 881 const content::TestWebUI::CallData& data = *web_ui_.call_data()[0];
882 const base::DictionaryValue* dictionary = nullptr; 882 const base::DictionaryValue* dictionary = nullptr;
883 ASSERT_TRUE(data.arg2()->GetAsDictionary(&dictionary)); 883 ASSERT_TRUE(data.arg2()->GetAsDictionary(&dictionary));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) 941 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed())
942 .WillRepeatedly(Return(false)); 942 .WillRepeatedly(Return(false));
943 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); 943 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0);
944 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); 944 EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _));
945 handler_->HandleConfigure(&list_args); 945 handler_->HandleConfigure(&list_args);
946 946
947 // Ensure that we navigated to the "done" state since we don't need a 947 // Ensure that we navigated to the "done" state since we don't need a
948 // passphrase. 948 // passphrase.
949 ExpectDone(); 949 ExpectDone();
950 } 950 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/sync_setup_handler.cc ('k') | chrome/browser/ui/webui/settings/people_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698