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

Unified Diff: chrome/browser/ui/webui/settings/people_handler_unittest.cc

Issue 1568963003: Revert of Settings People Revamp: Implement Chrome Profile name/icon selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/settings/people_handler_unittest.cc
diff --git a/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
index 48db8c87a5da99f9299873e728d95d95018caac2..3be38c6bc7a56f3647da734d802c7f9f03e785ae 100644
--- a/chrome/browser/ui/webui/settings/people_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/people_handler_unittest.cc
@@ -27,11 +27,9 @@
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/testing_profile_manager.h"
#include "components/signin/core/browser/fake_auth_status_provider.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/sync_driver/sync_prefs.h"
-#include "components/syncable_prefs/pref_service_syncable.h"
#include "content/public/browser/web_ui.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -187,27 +185,21 @@
void SetUp() override {
error_ = GoogleServiceAuthError::AuthErrorNone();
- profile_manager_.reset(
- new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
- ASSERT_TRUE(profile_manager_->SetUp());
-
- TestingProfile::TestingFactories testing_factories;
- testing_factories.push_back(std::make_pair(
- SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase));
- profile_ = profile_manager_->CreateTestingProfile(
- "Person 1", nullptr, base::UTF8ToUTF16("Person 1"), 0, std::string(),
- testing_factories);
+ TestingProfile::Builder builder;
+ builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
+ BuildFakeSigninManagerBase);
+ profile_ = builder.Build();
// Sign in the user.
mock_signin_ = static_cast<SigninManagerBase*>(
- SigninManagerFactory::GetForProfile(profile_));
+ SigninManagerFactory::GetForProfile(profile_.get()));
std::string username = GetTestUser();
if (!username.empty())
mock_signin_->SetAuthenticatedAccountInfo(username, username);
mock_pss_ = static_cast<ProfileSyncServiceMock*>(
ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
- profile_, BuildMockProfileSyncService));
+ profile_.get(), BuildMockProfileSyncService));
EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_));
ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault(
Return(syncer::IMPLICIT_PASSPHRASE));
@@ -218,7 +210,7 @@
mock_pss_->Initialize();
- handler_.reset(new TestingPeopleHandler(&web_ui_, profile_));
+ handler_.reset(new TestingPeopleHandler(&web_ui_, profile_.get()));
}
// Setup the expectations for calls made when displaying the config page.
@@ -278,7 +270,7 @@
handler_->CloseSyncSetup();
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
}
// It's difficult to notify sync listeners when using a ProfileSyncServiceMock
@@ -294,8 +286,7 @@
}
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<TestingProfileManager> profile_manager_;
- Profile* profile_;
+ scoped_ptr<Profile> profile_;
ProfileSyncServiceMock* mock_pss_;
GoogleServiceAuthError error_;
SigninManagerBase* mock_signin_;
@@ -323,14 +314,14 @@
// Sync setup hands off control to the gaia login tab.
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
ASSERT_FALSE(handler_->is_configuring_sync());
handler_->CloseSyncSetup();
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
}
TEST_F(PeopleHandlerTest, ShowSyncSetupWhenNotSignedIn) {
@@ -347,7 +338,7 @@
ASSERT_FALSE(handler_->is_configuring_sync());
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
}
#endif // !defined(OS_CHROMEOS)
@@ -360,7 +351,7 @@
// Sync setup is closed when sync is disabled.
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
ASSERT_FALSE(handler_->is_configuring_sync());
}
@@ -382,7 +373,7 @@
EXPECT_EQ(handler_.get(),
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
ExpectSpinnerAndClose();
}
@@ -459,7 +450,7 @@
handler_->CloseSyncSetup();
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
}
TEST_F(PeopleHandlerTest,
@@ -485,7 +476,7 @@
// On failure, the dialog will be closed.
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
}
#if !defined(OS_CHROMEOS)
@@ -766,7 +757,7 @@
SetupInitializedProfileSyncService();
mock_signin_->SetAuthenticatedAccountInfo(kTestUser, kTestUser);
FakeAuthStatusProvider provider(
- SigninErrorControllerFactory::GetForProfile(profile_));
+ SigninErrorControllerFactory::GetForProfile(profile_.get()));
provider.SetAuthError(kTestUser, error_);
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true));
EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
@@ -782,7 +773,7 @@
// clicking on the button in the UI will sign the user out rather than
// displaying a spinner. Should be no visible UI on ChromeOS in this case.
EXPECT_EQ(NULL, LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
#else
// On ChromeOS, this should display the spinner while we try to startup the
@@ -792,7 +783,7 @@
// Sync setup is closed when re-auth is in progress.
EXPECT_EQ(NULL,
LoginUIServiceFactory::GetForProfile(
- profile_)->current_login_ui());
+ profile_.get())->current_login_ui());
ASSERT_FALSE(handler_->is_configuring_sync());
#endif
@@ -871,7 +862,7 @@
ExpectConfig();
// Close the config overlay.
- LoginUIServiceFactory::GetForProfile(profile_)->LoginUIClosed(
+ LoginUIServiceFactory::GetForProfile(profile_.get())->LoginUIClosed(
handler_.get());
const content::TestWebUI::CallData& data = *web_ui_.call_data()[0];
const base::DictionaryValue* dictionary = nullptr;
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | chrome/browser/ui/webui/settings/settings_manage_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698