Index: chrome/browser/chromeos/login/login_manager_test_helper.cc |
diff --git a/chrome/browser/chromeos/login/login_manager_test.cc b/chrome/browser/chromeos/login/login_manager_test_helper.cc |
similarity index 67% |
rename from chrome/browser/chromeos/login/login_manager_test.cc |
rename to chrome/browser/chromeos/login/login_manager_test_helper.cc |
index 4d8738d6bf01e325f8d86a4ff0addc29ccc5016a..993929c743fc4ca15305a155853ce509ee0730c8 100644 |
--- a/chrome/browser/chromeos/login/login_manager_test.cc |
+++ b/chrome/browser/chromeos/login/login_manager_test_helper.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/chromeos/login/login_manager_test.h" |
+#include "chrome/browser/chromeos/login/login_manager_test_helper.h" |
#include "base/prefs/scoped_user_pref_update.h" |
#include "chrome/browser/browser_process.h" |
@@ -21,59 +21,55 @@ |
namespace chromeos { |
-LoginManagerTest::LoginManagerTest(bool should_launch_browser) |
- : should_launch_browser_(should_launch_browser), |
- web_contents_(NULL) { |
- set_exit_when_last_browser_closes(false); |
-} |
+LoginManagerTestHelper::LoginManagerTestHelper() : web_contents_(NULL) {} |
-void LoginManagerTest::CleanUpOnMainThread() { |
- if (LoginDisplayHostImpl::default_host()) |
- LoginDisplayHostImpl::default_host()->Finalize(); |
- base::MessageLoop::current()->RunUntilIdle(); |
+void LoginManagerTestHelper::SetUp() { |
+ content::WindowedNotificationObserver( |
+ chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
+ content::NotificationService::AllSources()).Wait(); |
+ InitializeWebContents(); |
} |
-void LoginManagerTest::SetUpCommandLine(CommandLine* command_line) { |
+void LoginManagerTestHelper::SetUpCommandLine(CommandLine* command_line) { |
command_line->AppendSwitch(chromeos::switches::kLoginManager); |
command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
command_line->AppendSwitch(::switches::kMultiProfiles); |
} |
-void LoginManagerTest::SetUpInProcessBrowserTestFixture() { |
+void LoginManagerTestHelper::SetUpLoginUtils(bool should_launch_browser) { |
mock_login_utils_ = new testing::NiceMock<MockLoginUtils>(); |
mock_login_utils_->DelegateToFake(); |
mock_login_utils_->GetFakeLoginUtils()->set_should_launch_browser( |
- should_launch_browser_); |
+ should_launch_browser); |
LoginUtils::Set(mock_login_utils_); |
} |
-void LoginManagerTest::SetUpOnMainThread() { |
- content::WindowedNotificationObserver( |
- chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, |
- content::NotificationService::AllSources()).Wait(); |
- InitializeWebContents(); |
+void LoginManagerTestHelper::CleanUp() { |
+ if (LoginDisplayHostImpl::default_host()) |
+ LoginDisplayHostImpl::default_host()->Finalize(); |
+ base::MessageLoop::current()->RunUntilIdle(); |
} |
-void LoginManagerTest::RegisterUser(const std::string& username) { |
+void LoginManagerTestHelper::RegisterUser(const std::string& username) { |
ListPrefUpdate users_pref(g_browser_process->local_state(), "LoggedInUsers"); |
users_pref->AppendIfNotPresent(new base::StringValue(username)); |
} |
-void LoginManagerTest::SetExpectedCredentials(const std::string& username, |
+void LoginManagerTestHelper::SetExpectedCredentials(const std::string& username, |
const std::string& password) { |
login_utils().GetFakeLoginUtils()->SetExpectedCredentials(username, password); |
} |
-bool LoginManagerTest::TryToLogin(const std::string& username, |
+bool LoginManagerTestHelper::TryToLogIn(const std::string& username, |
const std::string& password) { |
- if (!AddUserTosession(username, password)) |
+ if (!AddUserToSession(username, password)) |
return false; |
if (const User* active_user = UserManager::Get()->GetActiveUser()) |
return active_user->email() == username; |
return false; |
} |
-bool LoginManagerTest::AddUserTosession(const std::string& username, |
+bool LoginManagerTestHelper::AddUserToSession(const std::string& username, |
const std::string& password) { |
ExistingUserController* controller = |
ExistingUserController::current_controller(); |
@@ -94,29 +90,29 @@ bool LoginManagerTest::AddUserTosession(const std::string& username, |
return false; |
} |
-void LoginManagerTest::LoginUser(const std::string& username) { |
+void LoginManagerTestHelper::LogInUser(const std::string& username) { |
SetExpectedCredentials(username, "password"); |
- EXPECT_TRUE(TryToLogin(username, "password")); |
+ EXPECT_TRUE(TryToLogIn(username, "password")); |
} |
-void LoginManagerTest::AddUser(const std::string& username) { |
+void LoginManagerTestHelper::AddUser(const std::string& username) { |
SetExpectedCredentials(username, "password"); |
- EXPECT_TRUE(AddUserTosession(username, "password")); |
+ EXPECT_TRUE(AddUserToSession(username, "password")); |
} |
-void LoginManagerTest::JSExpect(const std::string& expression) { |
+void LoginManagerTestHelper::JSExpect(const std::string& expression) { |
js_checker_.ExpectTrue(expression); |
} |
-void LoginManagerTest::InitializeWebContents() { |
- LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); |
- EXPECT_TRUE(host != NULL); |
+void LoginManagerTestHelper::InitializeWebContents() { |
+ LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); |
+ EXPECT_TRUE(host != NULL); |
- content::WebContents* web_contents = |
- host->GetWebUILoginView()->GetWebContents(); |
- EXPECT_TRUE(web_contents != NULL); |
- set_web_contents(web_contents); |
- js_checker_.set_web_contents(web_contents); |
- } |
+ content::WebContents* web_contents = |
+ host->GetWebUILoginView()->GetWebContents(); |
+ EXPECT_TRUE(web_contents != NULL); |
+ set_web_contents(web_contents); |
+ js_checker_.set_web_contents(web_contents); |
+} |
} // namespace chromeos |