Chromium Code Reviews| 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 970973c9aab6333ccdfc4c4cfc79a0cd036fcfa2..2c4f9a6efaeee12c8cb41a75aef5869c417d5c72 100644 |
| --- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
| +++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc |
| @@ -91,11 +91,12 @@ bool GetScreenMagnifierEnabledFromPref() { |
| return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); |
| } |
| -// Creates and logs into a profile with account |name|, and makes sure that |
| -// the profile is regarded as "non new" in the next login. This is used in |
| +// Creates and logs into a profile with account |account_id|, and makes sure |
| +// that the profile is regarded as "non new" in the next login. This is used in |
| // PRE_XXX cases so that in the main XXX case we can test non new profiles. |
| -void PrepareNonNewProfile(const std::string& name) { |
| - user_manager::UserManager::Get()->UserLoggedIn(name, name, true); |
| +void PrepareNonNewProfile(const AccountId& account_id) { |
| + user_manager::UserManager::Get()->UserLoggedIn( |
| + account_id, account_id.GetUserEmail(), true); |
| // 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. UserLoggedIn(), however, does not yet |
| @@ -148,7 +149,8 @@ class MockMagnificationObserver { |
| class MagnificationManagerTest : public InProcessBrowserTest { |
| protected: |
| - MagnificationManagerTest() {} |
| + MagnificationManagerTest() |
| + : test_account_id_(AccountId::FromUserEmail(kTestUserName)) {} |
| ~MagnificationManagerTest() override {} |
| void SetUpCommandLine(base::CommandLine* command_line) override { |
| @@ -163,12 +165,14 @@ class MagnificationManagerTest : public InProcessBrowserTest { |
| ProfileManager::GetActiveUserProfile()); |
| } |
| + const AccountId test_account_id_; |
|
achuithb
2015/10/23 00:08:49
const AccountId test_account_id_ = AccountId::From
Alexander Alekseev
2015/10/23 09:11:21
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); |
| }; |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) { |
| // Create a new profile once, to run the test with non-new profile. |
| - PrepareNonNewProfile(kTestUserName); |
| + PrepareNonNewProfile(test_account_id_); |
| // Sets pref to explicitly disable the magnifier. |
| SetScreenMagnifierEnabledPref(false); |
| @@ -183,8 +187,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| // Logs in with existing profile. |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is still disabled just after login. |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| @@ -204,7 +208,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { |
| // Create a new profile once, to run the test with non-new profile. |
| - PrepareNonNewProfile(kTestUserName); |
| + PrepareNonNewProfile(test_account_id_); |
| // Sets pref to explicitly disable the magnifier. |
| SetScreenMagnifierEnabledPref(false); |
| @@ -223,8 +227,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { |
| EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping enabled. |
| EXPECT_TRUE(IsMagnifierEnabled()); |
| @@ -239,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { |
| // Create a new profile once, to run the test with non-new profile. |
| - PrepareNonNewProfile(kTestUserName); |
| + PrepareNonNewProfile(test_account_id_); |
| // Sets prefs to explicitly enable the magnifier. |
| SetScreenMagnifierEnabledPref(true); |
| @@ -253,8 +257,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping disabled. |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| @@ -271,7 +275,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { |
| // Create a new profile once, to run the test with non-new profile. |
| - PrepareNonNewProfile(kTestUserName); |
| + PrepareNonNewProfile(test_account_id_); |
| // Sets prefs to explicitly enable the magnifier. |
| SetScreenMagnifierEnabledPref(true); |
| @@ -289,8 +293,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
| EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping enabled. |
| EXPECT_TRUE(IsMagnifierEnabled()); |
| @@ -308,7 +312,7 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { |
| // Creates a new profile once, to run the test with non-new profile. |
| - PrepareNonNewProfile(kTestUserName); |
| + PrepareNonNewProfile(test_account_id_); |
| } |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
| @@ -319,8 +323,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
| EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping enabled. |
| EXPECT_TRUE(IsMagnifierEnabled()); |
| @@ -341,8 +345,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { |
| SetMagnifierEnabled(false); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping disabled. |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| @@ -364,8 +368,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { |
| EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping enabled. |
| EXPECT_TRUE(IsMagnifierEnabled()); |
| @@ -385,8 +389,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| // Logs in (but the session is not started yet). |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| // Confirms that magnifier is keeping disabled. |
| EXPECT_FALSE(IsMagnifierEnabled()); |
| @@ -457,8 +461,8 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) { |
| IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { |
| // Logs in |
| - user_manager::UserManager::Get()->UserLoggedIn( |
| - kTestUserName, kTestUserName, true); |
| + user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| + kTestUserName, true); |
| user_manager::UserManager::Get()->SessionStarted(); |
| // Confirms that magnifier is disabled just after login. |