Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "ash/magnifier/magnification_controller.h" | 7 #include "ash/magnifier/magnification_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 } | 84 } |
| 85 | 85 |
| 86 void SetFullScreenMagnifierScalePref(double scale) { | 86 void SetFullScreenMagnifierScalePref(double scale) { |
| 87 prefs()->SetDouble(prefs::kAccessibilityScreenMagnifierScale, scale); | 87 prefs()->SetDouble(prefs::kAccessibilityScreenMagnifierScale, scale); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool GetScreenMagnifierEnabledFromPref() { | 90 bool GetScreenMagnifierEnabledFromPref() { |
| 91 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); | 91 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Creates and logs into a profile with account |name|, and makes sure that | 94 // Creates and logs into a profile with account |account_id|, and makes sure |
| 95 // the profile is regarded as "non new" in the next login. This is used in | 95 // that the profile is regarded as "non new" in the next login. This is used in |
| 96 // PRE_XXX cases so that in the main XXX case we can test non new profiles. | 96 // PRE_XXX cases so that in the main XXX case we can test non new profiles. |
| 97 void PrepareNonNewProfile(const std::string& name) { | 97 void PrepareNonNewProfile(const AccountId& account_id) { |
| 98 user_manager::UserManager::Get()->UserLoggedIn(name, name, true); | 98 user_manager::UserManager::Get()->UserLoggedIn( |
| 99 account_id, account_id.GetUserEmail(), true); | |
| 99 // To prepare a non-new profile for tests, we must ensure the profile | 100 // To prepare a non-new profile for tests, we must ensure the profile |
| 100 // directory and the preference files are created, because that's what | 101 // directory and the preference files are created, because that's what |
| 101 // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet | 102 // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet |
| 102 // create the profile directory until GetActiveUserProfile() is called. | 103 // create the profile directory until GetActiveUserProfile() is called. |
| 103 ProfileManager::GetActiveUserProfile(); | 104 ProfileManager::GetActiveUserProfile(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace | 107 } // namespace |
| 107 | 108 |
| 108 class MockMagnificationObserver { | 109 class MockMagnificationObserver { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 int magnifier_type_; | 142 int magnifier_type_; |
| 142 | 143 |
| 143 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 144 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 144 | 145 |
| 145 DISALLOW_COPY_AND_ASSIGN(MockMagnificationObserver); | 146 DISALLOW_COPY_AND_ASSIGN(MockMagnificationObserver); |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 | 149 |
| 149 class MagnificationManagerTest : public InProcessBrowserTest { | 150 class MagnificationManagerTest : public InProcessBrowserTest { |
| 150 protected: | 151 protected: |
| 151 MagnificationManagerTest() {} | 152 MagnificationManagerTest() |
| 153 : test_account_id_(AccountId::FromUserEmail(kTestUserName)) {} | |
| 152 ~MagnificationManagerTest() override {} | 154 ~MagnificationManagerTest() override {} |
| 153 | 155 |
| 154 void SetUpCommandLine(base::CommandLine* command_line) override { | 156 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 155 command_line->AppendSwitch(switches::kLoginManager); | 157 command_line->AppendSwitch(switches::kLoginManager); |
| 156 command_line->AppendSwitchASCII(switches::kLoginProfile, | 158 command_line->AppendSwitchASCII(switches::kLoginProfile, |
| 157 TestingProfile::kTestUserProfileDir); | 159 TestingProfile::kTestUserProfileDir); |
| 158 } | 160 } |
| 159 | 161 |
| 160 void SetUpOnMainThread() override { | 162 void SetUpOnMainThread() override { |
| 161 // Set the login-screen profile. | 163 // Set the login-screen profile. |
| 162 MagnificationManager::Get()->SetProfileForTest( | 164 MagnificationManager::Get()->SetProfileForTest( |
| 163 ProfileManager::GetActiveUserProfile()); | 165 ProfileManager::GetActiveUserProfile()); |
| 164 } | 166 } |
| 165 | 167 |
| 168 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.
| |
| 169 | |
| 166 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); | 170 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); |
| 167 }; | 171 }; |
| 168 | 172 |
| 169 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) { | 173 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) { |
| 170 // Create a new profile once, to run the test with non-new profile. | 174 // Create a new profile once, to run the test with non-new profile. |
| 171 PrepareNonNewProfile(kTestUserName); | 175 PrepareNonNewProfile(test_account_id_); |
| 172 | 176 |
| 173 // Sets pref to explicitly disable the magnifier. | 177 // Sets pref to explicitly disable the magnifier. |
| 174 SetScreenMagnifierEnabledPref(false); | 178 SetScreenMagnifierEnabledPref(false); |
| 175 } | 179 } |
| 176 | 180 |
| 177 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { | 181 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
| 178 // Confirms that magnifier is disabled on the login screen. | 182 // Confirms that magnifier is disabled on the login screen. |
| 179 EXPECT_FALSE(IsMagnifierEnabled()); | 183 EXPECT_FALSE(IsMagnifierEnabled()); |
| 180 | 184 |
| 181 // Disables magnifier on login screen. | 185 // Disables magnifier on login screen. |
| 182 SetMagnifierEnabled(false); | 186 SetMagnifierEnabled(false); |
| 183 EXPECT_FALSE(IsMagnifierEnabled()); | 187 EXPECT_FALSE(IsMagnifierEnabled()); |
| 184 | 188 |
| 185 // Logs in with existing profile. | 189 // Logs in with existing profile. |
| 186 user_manager::UserManager::Get()->UserLoggedIn( | 190 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 187 kTestUserName, kTestUserName, true); | 191 kTestUserName, true); |
| 188 | 192 |
| 189 // Confirms that magnifier is still disabled just after login. | 193 // Confirms that magnifier is still disabled just after login. |
| 190 EXPECT_FALSE(IsMagnifierEnabled()); | 194 EXPECT_FALSE(IsMagnifierEnabled()); |
| 191 | 195 |
| 192 user_manager::UserManager::Get()->SessionStarted(); | 196 user_manager::UserManager::Get()->SessionStarted(); |
| 193 | 197 |
| 194 // Confirms that magnifier is still disabled just after session starts. | 198 // Confirms that magnifier is still disabled just after session starts. |
| 195 EXPECT_FALSE(IsMagnifierEnabled()); | 199 EXPECT_FALSE(IsMagnifierEnabled()); |
| 196 | 200 |
| 197 // Enables magnifier. | 201 // Enables magnifier. |
| 198 SetMagnifierEnabled(true); | 202 SetMagnifierEnabled(true); |
| 199 // Confirms that magnifier is enabled. | 203 // Confirms that magnifier is enabled. |
| 200 EXPECT_TRUE(IsMagnifierEnabled()); | 204 EXPECT_TRUE(IsMagnifierEnabled()); |
| 201 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 205 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 202 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 206 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
| 203 } | 207 } |
| 204 | 208 |
| 205 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { | 209 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { |
| 206 // Create a new profile once, to run the test with non-new profile. | 210 // Create a new profile once, to run the test with non-new profile. |
| 207 PrepareNonNewProfile(kTestUserName); | 211 PrepareNonNewProfile(test_account_id_); |
| 208 | 212 |
| 209 // Sets pref to explicitly disable the magnifier. | 213 // Sets pref to explicitly disable the magnifier. |
| 210 SetScreenMagnifierEnabledPref(false); | 214 SetScreenMagnifierEnabledPref(false); |
| 211 } | 215 } |
| 212 | 216 |
| 213 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { | 217 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { |
| 214 // Confirms that magnifier is disabled on the login screen. | 218 // Confirms that magnifier is disabled on the login screen. |
| 215 EXPECT_FALSE(IsMagnifierEnabled()); | 219 EXPECT_FALSE(IsMagnifierEnabled()); |
| 216 | 220 |
| 217 // Enables magnifier on login screen. | 221 // Enables magnifier on login screen. |
| 218 SetMagnifierEnabled(true); | 222 SetMagnifierEnabled(true); |
| 219 SetMagnifierType(ui::MAGNIFIER_FULL); | 223 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 220 SetFullScreenMagnifierScale(2.5); | 224 SetFullScreenMagnifierScale(2.5); |
| 221 EXPECT_TRUE(IsMagnifierEnabled()); | 225 EXPECT_TRUE(IsMagnifierEnabled()); |
| 222 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 226 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 223 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 227 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| 224 | 228 |
| 225 // Logs in (but the session is not started yet). | 229 // Logs in (but the session is not started yet). |
| 226 user_manager::UserManager::Get()->UserLoggedIn( | 230 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 227 kTestUserName, kTestUserName, true); | 231 kTestUserName, true); |
| 228 | 232 |
| 229 // Confirms that magnifier is keeping enabled. | 233 // Confirms that magnifier is keeping enabled. |
| 230 EXPECT_TRUE(IsMagnifierEnabled()); | 234 EXPECT_TRUE(IsMagnifierEnabled()); |
| 231 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 235 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 232 | 236 |
| 233 user_manager::UserManager::Get()->SessionStarted(); | 237 user_manager::UserManager::Get()->SessionStarted(); |
| 234 | 238 |
| 235 // Confirms that magnifier is disabled just after session start. | 239 // Confirms that magnifier is disabled just after session start. |
| 236 EXPECT_FALSE(IsMagnifierEnabled()); | 240 EXPECT_FALSE(IsMagnifierEnabled()); |
| 237 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 241 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
| 238 } | 242 } |
| 239 | 243 |
| 240 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { | 244 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { |
| 241 // Create a new profile once, to run the test with non-new profile. | 245 // Create a new profile once, to run the test with non-new profile. |
| 242 PrepareNonNewProfile(kTestUserName); | 246 PrepareNonNewProfile(test_account_id_); |
| 243 | 247 |
| 244 // Sets prefs to explicitly enable the magnifier. | 248 // Sets prefs to explicitly enable the magnifier. |
| 245 SetScreenMagnifierEnabledPref(true); | 249 SetScreenMagnifierEnabledPref(true); |
| 246 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 250 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
| 247 SetFullScreenMagnifierScalePref(2.5); | 251 SetFullScreenMagnifierScalePref(2.5); |
| 248 } | 252 } |
| 249 | 253 |
| 250 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { | 254 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
| 251 // Disables magnifier on login screen. | 255 // Disables magnifier on login screen. |
| 252 SetMagnifierEnabled(false); | 256 SetMagnifierEnabled(false); |
| 253 EXPECT_FALSE(IsMagnifierEnabled()); | 257 EXPECT_FALSE(IsMagnifierEnabled()); |
| 254 | 258 |
| 255 // Logs in (but the session is not started yet). | 259 // Logs in (but the session is not started yet). |
| 256 user_manager::UserManager::Get()->UserLoggedIn( | 260 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 257 kTestUserName, kTestUserName, true); | 261 kTestUserName, true); |
| 258 | 262 |
| 259 // Confirms that magnifier is keeping disabled. | 263 // Confirms that magnifier is keeping disabled. |
| 260 EXPECT_FALSE(IsMagnifierEnabled()); | 264 EXPECT_FALSE(IsMagnifierEnabled()); |
| 261 | 265 |
| 262 user_manager::UserManager::Get()->SessionStarted(); | 266 user_manager::UserManager::Get()->SessionStarted(); |
| 263 | 267 |
| 264 // Confirms that the magnifier is enabled and configured according to the | 268 // Confirms that the magnifier is enabled and configured according to the |
| 265 // explicitly set prefs just after session start. | 269 // explicitly set prefs just after session start. |
| 266 EXPECT_TRUE(IsMagnifierEnabled()); | 270 EXPECT_TRUE(IsMagnifierEnabled()); |
| 267 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 271 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 268 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 272 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| 269 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 273 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
| 270 } | 274 } |
| 271 | 275 |
| 272 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { | 276 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { |
| 273 // Create a new profile once, to run the test with non-new profile. | 277 // Create a new profile once, to run the test with non-new profile. |
| 274 PrepareNonNewProfile(kTestUserName); | 278 PrepareNonNewProfile(test_account_id_); |
| 275 | 279 |
| 276 // Sets prefs to explicitly enable the magnifier. | 280 // Sets prefs to explicitly enable the magnifier. |
| 277 SetScreenMagnifierEnabledPref(true); | 281 SetScreenMagnifierEnabledPref(true); |
| 278 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 282 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
| 279 SetFullScreenMagnifierScalePref(2.5); | 283 SetFullScreenMagnifierScalePref(2.5); |
| 280 } | 284 } |
| 281 | 285 |
| 282 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { | 286 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
| 283 // Enables magnifier on login screen. | 287 // Enables magnifier on login screen. |
| 284 SetMagnifierType(ui::MAGNIFIER_FULL); | 288 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 285 SetMagnifierEnabled(true); | 289 SetMagnifierEnabled(true); |
| 286 SetFullScreenMagnifierScale(3.0); | 290 SetFullScreenMagnifierScale(3.0); |
| 287 EXPECT_TRUE(IsMagnifierEnabled()); | 291 EXPECT_TRUE(IsMagnifierEnabled()); |
| 288 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 292 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 289 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); | 293 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); |
| 290 | 294 |
| 291 // Logs in (but the session is not started yet). | 295 // Logs in (but the session is not started yet). |
| 292 user_manager::UserManager::Get()->UserLoggedIn( | 296 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 293 kTestUserName, kTestUserName, true); | 297 kTestUserName, true); |
| 294 | 298 |
| 295 // Confirms that magnifier is keeping enabled. | 299 // Confirms that magnifier is keeping enabled. |
| 296 EXPECT_TRUE(IsMagnifierEnabled()); | 300 EXPECT_TRUE(IsMagnifierEnabled()); |
| 297 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 301 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 298 | 302 |
| 299 user_manager::UserManager::Get()->SessionStarted(); | 303 user_manager::UserManager::Get()->SessionStarted(); |
| 300 | 304 |
| 301 // Confirms that the magnifier is enabled and configured according to the | 305 // Confirms that the magnifier is enabled and configured according to the |
| 302 // explicitly set prefs just after session start. | 306 // explicitly set prefs just after session start. |
| 303 EXPECT_TRUE(IsMagnifierEnabled()); | 307 EXPECT_TRUE(IsMagnifierEnabled()); |
| 304 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 308 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 305 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 309 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| 306 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 310 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
| 307 } | 311 } |
| 308 | 312 |
| 309 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { | 313 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { |
| 310 // Creates a new profile once, to run the test with non-new profile. | 314 // Creates a new profile once, to run the test with non-new profile. |
| 311 PrepareNonNewProfile(kTestUserName); | 315 PrepareNonNewProfile(test_account_id_); |
| 312 } | 316 } |
| 313 | 317 |
| 314 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { | 318 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
| 315 // Enables full screen magnifier. | 319 // Enables full screen magnifier. |
| 316 SetMagnifierType(ui::MAGNIFIER_FULL); | 320 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 317 SetMagnifierEnabled(true); | 321 SetMagnifierEnabled(true); |
| 318 EXPECT_TRUE(IsMagnifierEnabled()); | 322 EXPECT_TRUE(IsMagnifierEnabled()); |
| 319 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 323 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 320 | 324 |
| 321 // Logs in (but the session is not started yet). | 325 // Logs in (but the session is not started yet). |
| 322 user_manager::UserManager::Get()->UserLoggedIn( | 326 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 323 kTestUserName, kTestUserName, true); | 327 kTestUserName, true); |
| 324 | 328 |
| 325 // Confirms that magnifier is keeping enabled. | 329 // Confirms that magnifier is keeping enabled. |
| 326 EXPECT_TRUE(IsMagnifierEnabled()); | 330 EXPECT_TRUE(IsMagnifierEnabled()); |
| 327 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 331 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 328 | 332 |
| 329 user_manager::UserManager::Get()->SessionStarted(); | 333 user_manager::UserManager::Get()->SessionStarted(); |
| 330 | 334 |
| 331 // Confirms that magnifier is disabled. | 335 // Confirms that magnifier is disabled. |
| 332 EXPECT_FALSE(IsMagnifierEnabled()); | 336 EXPECT_FALSE(IsMagnifierEnabled()); |
| 333 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 337 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
| 334 } | 338 } |
| 335 | 339 |
| 336 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { | 340 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { |
| 337 // Confirms that magnifier is disabled on the login screen. | 341 // Confirms that magnifier is disabled on the login screen. |
| 338 EXPECT_FALSE(IsMagnifierEnabled()); | 342 EXPECT_FALSE(IsMagnifierEnabled()); |
| 339 | 343 |
| 340 // Disables magnifier on login screen explicitly. | 344 // Disables magnifier on login screen explicitly. |
| 341 SetMagnifierEnabled(false); | 345 SetMagnifierEnabled(false); |
| 342 | 346 |
| 343 // Logs in (but the session is not started yet). | 347 // Logs in (but the session is not started yet). |
| 344 user_manager::UserManager::Get()->UserLoggedIn( | 348 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 345 kTestUserName, kTestUserName, true); | 349 kTestUserName, true); |
| 346 | 350 |
| 347 // Confirms that magnifier is keeping disabled. | 351 // Confirms that magnifier is keeping disabled. |
| 348 EXPECT_FALSE(IsMagnifierEnabled()); | 352 EXPECT_FALSE(IsMagnifierEnabled()); |
| 349 | 353 |
| 350 user_manager::UserManager::Get()->SessionStarted(); | 354 user_manager::UserManager::Get()->SessionStarted(); |
| 351 | 355 |
| 352 // Confirms that magnifier is keeping disabled. | 356 // Confirms that magnifier is keeping disabled. |
| 353 EXPECT_FALSE(IsMagnifierEnabled()); | 357 EXPECT_FALSE(IsMagnifierEnabled()); |
| 354 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 358 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
| 355 } | 359 } |
| 356 | 360 |
| 357 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { | 361 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { |
| 358 // Enables magnifier on login screen. | 362 // Enables magnifier on login screen. |
| 359 SetMagnifierType(ui::MAGNIFIER_FULL); | 363 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 360 SetMagnifierEnabled(true); | 364 SetMagnifierEnabled(true); |
| 361 SetFullScreenMagnifierScale(2.5); | 365 SetFullScreenMagnifierScale(2.5); |
| 362 EXPECT_TRUE(IsMagnifierEnabled()); | 366 EXPECT_TRUE(IsMagnifierEnabled()); |
| 363 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 367 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 364 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 368 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| 365 | 369 |
| 366 // Logs in (but the session is not started yet). | 370 // Logs in (but the session is not started yet). |
| 367 user_manager::UserManager::Get()->UserLoggedIn( | 371 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 368 kTestUserName, kTestUserName, true); | 372 kTestUserName, true); |
| 369 | 373 |
| 370 // Confirms that magnifier is keeping enabled. | 374 // Confirms that magnifier is keeping enabled. |
| 371 EXPECT_TRUE(IsMagnifierEnabled()); | 375 EXPECT_TRUE(IsMagnifierEnabled()); |
| 372 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 376 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 373 | 377 |
| 374 user_manager::UserManager::Get()->SessionStarted(); | 378 user_manager::UserManager::Get()->SessionStarted(); |
| 375 | 379 |
| 376 // Confirms that magnifier keeps enabled. | 380 // Confirms that magnifier keeps enabled. |
| 377 EXPECT_TRUE(IsMagnifierEnabled()); | 381 EXPECT_TRUE(IsMagnifierEnabled()); |
| 378 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 382 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 379 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 383 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
| 380 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 384 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
| 381 } | 385 } |
| 382 | 386 |
| 383 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { | 387 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { |
| 384 // Confirms that magnifier is disabled on the login screen. | 388 // Confirms that magnifier is disabled on the login screen. |
| 385 EXPECT_FALSE(IsMagnifierEnabled()); | 389 EXPECT_FALSE(IsMagnifierEnabled()); |
| 386 | 390 |
| 387 // Logs in (but the session is not started yet). | 391 // Logs in (but the session is not started yet). |
| 388 user_manager::UserManager::Get()->UserLoggedIn( | 392 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 389 kTestUserName, kTestUserName, true); | 393 kTestUserName, true); |
| 390 | 394 |
| 391 // Confirms that magnifier is keeping disabled. | 395 // Confirms that magnifier is keeping disabled. |
| 392 EXPECT_FALSE(IsMagnifierEnabled()); | 396 EXPECT_FALSE(IsMagnifierEnabled()); |
| 393 | 397 |
| 394 user_manager::UserManager::Get()->SessionStarted(); | 398 user_manager::UserManager::Get()->SessionStarted(); |
| 395 | 399 |
| 396 // Confirms that magnifier is keeping disabled. | 400 // Confirms that magnifier is keeping disabled. |
| 397 EXPECT_FALSE(IsMagnifierEnabled()); | 401 EXPECT_FALSE(IsMagnifierEnabled()); |
| 398 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 402 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
| 399 } | 403 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 EXPECT_FALSE(IsMagnifierEnabled()); | 454 EXPECT_FALSE(IsMagnifierEnabled()); |
| 451 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 455 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 452 | 456 |
| 453 SetMagnifierType(ui::MAGNIFIER_FULL); | 457 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 454 EXPECT_FALSE(IsMagnifierEnabled()); | 458 EXPECT_FALSE(IsMagnifierEnabled()); |
| 455 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 459 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
| 456 } | 460 } |
| 457 | 461 |
| 458 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { | 462 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { |
| 459 // Logs in | 463 // Logs in |
| 460 user_manager::UserManager::Get()->UserLoggedIn( | 464 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
| 461 kTestUserName, kTestUserName, true); | 465 kTestUserName, true); |
| 462 user_manager::UserManager::Get()->SessionStarted(); | 466 user_manager::UserManager::Get()->SessionStarted(); |
| 463 | 467 |
| 464 // Confirms that magnifier is disabled just after login. | 468 // Confirms that magnifier is disabled just after login. |
| 465 EXPECT_FALSE(IsMagnifierEnabled()); | 469 EXPECT_FALSE(IsMagnifierEnabled()); |
| 466 | 470 |
| 467 // Sets the pref as true to enable magnifier. | 471 // Sets the pref as true to enable magnifier. |
| 468 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 472 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
| 469 SetScreenMagnifierEnabledPref(true); | 473 SetScreenMagnifierEnabledPref(true); |
| 470 // Confirms that magnifier is enabled. | 474 // Confirms that magnifier is enabled. |
| 471 EXPECT_TRUE(IsMagnifierEnabled()); | 475 EXPECT_TRUE(IsMagnifierEnabled()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 observer.reset(); | 546 observer.reset(); |
| 543 | 547 |
| 544 // Set full screen magnifier again, and confirm the observer is not called. | 548 // Set full screen magnifier again, and confirm the observer is not called. |
| 545 SetMagnifierType(ui::MAGNIFIER_FULL); | 549 SetMagnifierType(ui::MAGNIFIER_FULL); |
| 546 EXPECT_FALSE(observer.observed()); | 550 EXPECT_FALSE(observer.observed()); |
| 547 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); | 551 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); |
| 548 observer.reset(); | 552 observer.reset(); |
| 549 } | 553 } |
| 550 | 554 |
| 551 } // namespace chromeos | 555 } // namespace chromeos |
| OLD | NEW |