Index: chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
index 2e3c485731e388806cb489a7c8d8cb3eb8489bc1..720534c5970e8474110f5408262efad603947bfe 100644 |
--- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
+++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
@@ -14,6 +14,7 @@ |
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
#include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
#include "chrome/browser/chromeos/login/helper.h" |
+#include "chrome/browser/chromeos/profiles/profile_helper.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/common/chrome_switches.h" |
@@ -101,8 +102,20 @@ void PrepareNonNewProfile(const AccountId& account_id) { |
// To prepare a non-new profile for tests, we must ensure the profile |
// directory and the preference files are created, because that's what |
// Profile::IsNewProfile() checks. CreateSession(), however, does not yet |
- // create the profile directory until GetActiveUserProfile() is called. |
- ProfileManager::GetActiveUserProfile(); |
+ // create the profile directory until GetProfile() is called. |
+ g_browser_process->profile_manager()->GetProfile( |
+ ProfileHelper::Get()->GetProfilePathByUserIdHash( |
+ account_id.GetUserEmail())); |
+} |
+ |
+// Simulates how UserSessionManager starts a user session by loading user |
+// profile and mark session as started. |
+void StartUserSession(const AccountId& account_id) { |
+ g_browser_process->profile_manager()->GetProfile( |
+ ProfileHelper::Get()->GetProfilePathByUserIdHash( |
+ account_id.GetUserEmail())); |
+ |
+ session_manager::SessionManager::Get()->SessionStarted(); |
} |
} // namespace |
@@ -193,7 +206,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
// Confirms that magnifier is still disabled just after login. |
EXPECT_FALSE(IsMagnifierEnabled()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is still disabled just after session starts. |
EXPECT_FALSE(IsMagnifierEnabled()); |
@@ -234,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { |
EXPECT_TRUE(IsMagnifierEnabled()); |
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is disabled just after session start. |
EXPECT_FALSE(IsMagnifierEnabled()); |
@@ -263,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
// Confirms that magnifier is keeping disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that the magnifier is enabled and configured according to the |
// explicitly set prefs just after session start. |
@@ -300,7 +313,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
EXPECT_TRUE(IsMagnifierEnabled()); |
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that the magnifier is enabled and configured according to the |
// explicitly set prefs just after session start. |
@@ -330,7 +343,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
EXPECT_TRUE(IsMagnifierEnabled()); |
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
@@ -351,7 +364,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { |
// Confirms that magnifier is keeping disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is keeping disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
@@ -375,7 +388,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { |
EXPECT_TRUE(IsMagnifierEnabled()); |
EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier keeps enabled. |
EXPECT_TRUE(IsMagnifierEnabled()); |
@@ -395,7 +408,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { |
// Confirms that magnifier is keeping disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is keeping disabled. |
EXPECT_FALSE(IsMagnifierEnabled()); |
@@ -463,7 +476,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { |
// Logs in |
session_manager::SessionManager::Get()->CreateSession(test_account_id_, |
kTestUserName); |
- session_manager::SessionManager::Get()->SessionStarted(); |
+ StartUserSession(test_account_id_); |
// Confirms that magnifier is disabled just after login. |
EXPECT_FALSE(IsMagnifierEnabled()); |