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" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
15 #include "chrome/browser/chromeos/login/helper.h" | 15 #include "chrome/browser/chromeos/login/helper.h" |
16 #include "chrome/browser/chromeos/login/login_utils.h" | 16 #include "chrome/browser/chromeos/login/login_utils.h" |
17 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
22 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
23 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
24 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
| 24 #include "components/user_manager/user_manager.h" |
25 #include "components/user_prefs/user_prefs.h" | 25 #include "components/user_prefs/user_prefs.h" |
26 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 | 29 |
30 namespace chromeos { | 30 namespace chromeos { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const char kTestUserName[] = "owner@invalid.domain"; | 34 const char kTestUserName[] = "owner@invalid.domain"; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 | 90 |
91 bool GetScreenMagnifierEnabledFromPref() { | 91 bool GetScreenMagnifierEnabledFromPref() { |
92 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); | 92 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); |
93 } | 93 } |
94 | 94 |
95 // Creates and logs into a profile with account |name|, and makes sure that | 95 // Creates and logs into a profile with account |name|, and makes sure that |
96 // the profile is regarded as "non new" in the next login. This is used in | 96 // the profile is regarded as "non new" in the next login. This is used in |
97 // PRE_XXX cases so that in the main XXX case we can test non new profiles. | 97 // PRE_XXX cases so that in the main XXX case we can test non new profiles. |
98 void PrepareNonNewProfile(const std::string& name) { | 98 void PrepareNonNewProfile(const std::string& name) { |
99 UserManager::Get()->UserLoggedIn(name, name, true); | 99 user_manager::UserManager::Get()->UserLoggedIn(name, name, true); |
100 // 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 |
101 // directory and the preference files are created, because that's what | 101 // directory and the preference files are created, because that's what |
102 // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet | 102 // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet |
103 // create the profile directory until GetActiveUserProfile() is called. | 103 // create the profile directory until GetActiveUserProfile() is called. |
104 ProfileManager::GetActiveUserProfile(); | 104 ProfileManager::GetActiveUserProfile(); |
105 } | 105 } |
106 | 106 |
107 } // namespace | 107 } // namespace |
108 | 108 |
109 class MockMagnificationObserver { | 109 class MockMagnificationObserver { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { | 178 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
179 // Confirms that magnifier is disabled on the login screen. | 179 // Confirms that magnifier is disabled on the login screen. |
180 EXPECT_FALSE(IsMagnifierEnabled()); | 180 EXPECT_FALSE(IsMagnifierEnabled()); |
181 | 181 |
182 // Disables magnifier on login screen. | 182 // Disables magnifier on login screen. |
183 SetMagnifierEnabled(false); | 183 SetMagnifierEnabled(false); |
184 EXPECT_FALSE(IsMagnifierEnabled()); | 184 EXPECT_FALSE(IsMagnifierEnabled()); |
185 | 185 |
186 // Logs in with existing profile. | 186 // Logs in with existing profile. |
187 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 187 user_manager::UserManager::Get()->UserLoggedIn( |
| 188 kTestUserName, kTestUserName, true); |
188 | 189 |
189 // Confirms that magnifier is still disabled just after login. | 190 // Confirms that magnifier is still disabled just after login. |
190 EXPECT_FALSE(IsMagnifierEnabled()); | 191 EXPECT_FALSE(IsMagnifierEnabled()); |
191 | 192 |
192 UserManager::Get()->SessionStarted(); | 193 user_manager::UserManager::Get()->SessionStarted(); |
193 | 194 |
194 // Confirms that magnifier is still disabled just after session starts. | 195 // Confirms that magnifier is still disabled just after session starts. |
195 EXPECT_FALSE(IsMagnifierEnabled()); | 196 EXPECT_FALSE(IsMagnifierEnabled()); |
196 | 197 |
197 // Enables magnifier. | 198 // Enables magnifier. |
198 SetMagnifierEnabled(true); | 199 SetMagnifierEnabled(true); |
199 // Confirms that magnifier is enabled. | 200 // Confirms that magnifier is enabled. |
200 EXPECT_TRUE(IsMagnifierEnabled()); | 201 EXPECT_TRUE(IsMagnifierEnabled()); |
201 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 202 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
202 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 203 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
(...skipping 13 matching lines...) Expand all Loading... |
216 | 217 |
217 // Enables magnifier on login screen. | 218 // Enables magnifier on login screen. |
218 SetMagnifierEnabled(true); | 219 SetMagnifierEnabled(true); |
219 SetMagnifierType(ash::MAGNIFIER_FULL); | 220 SetMagnifierType(ash::MAGNIFIER_FULL); |
220 SetFullScreenMagnifierScale(2.5); | 221 SetFullScreenMagnifierScale(2.5); |
221 EXPECT_TRUE(IsMagnifierEnabled()); | 222 EXPECT_TRUE(IsMagnifierEnabled()); |
222 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 223 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
223 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 224 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
224 | 225 |
225 // Logs in (but the session is not started yet). | 226 // Logs in (but the session is not started yet). |
226 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 227 user_manager::UserManager::Get()->UserLoggedIn( |
| 228 kTestUserName, kTestUserName, true); |
227 | 229 |
228 // Confirms that magnifier is keeping enabled. | 230 // Confirms that magnifier is keeping enabled. |
229 EXPECT_TRUE(IsMagnifierEnabled()); | 231 EXPECT_TRUE(IsMagnifierEnabled()); |
230 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 232 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
231 | 233 |
232 UserManager::Get()->SessionStarted(); | 234 user_manager::UserManager::Get()->SessionStarted(); |
233 | 235 |
234 // Confirms that magnifier is disabled just after session start. | 236 // Confirms that magnifier is disabled just after session start. |
235 EXPECT_FALSE(IsMagnifierEnabled()); | 237 EXPECT_FALSE(IsMagnifierEnabled()); |
236 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 238 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
237 } | 239 } |
238 | 240 |
239 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { | 241 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { |
240 // Create a new profile once, to run the test with non-new profile. | 242 // Create a new profile once, to run the test with non-new profile. |
241 PrepareNonNewProfile(kTestUserName); | 243 PrepareNonNewProfile(kTestUserName); |
242 | 244 |
243 // Sets prefs to explicitly enable the magnifier. | 245 // Sets prefs to explicitly enable the magnifier. |
244 SetScreenMagnifierEnabledPref(true); | 246 SetScreenMagnifierEnabledPref(true); |
245 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); | 247 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); |
246 SetFullScreenMagnifierScalePref(2.5); | 248 SetFullScreenMagnifierScalePref(2.5); |
247 } | 249 } |
248 | 250 |
249 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { | 251 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
250 // Disables magnifier on login screen. | 252 // Disables magnifier on login screen. |
251 SetMagnifierEnabled(false); | 253 SetMagnifierEnabled(false); |
252 EXPECT_FALSE(IsMagnifierEnabled()); | 254 EXPECT_FALSE(IsMagnifierEnabled()); |
253 | 255 |
254 // Logs in (but the session is not started yet). | 256 // Logs in (but the session is not started yet). |
255 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 257 user_manager::UserManager::Get()->UserLoggedIn( |
| 258 kTestUserName, kTestUserName, true); |
256 | 259 |
257 // Confirms that magnifier is keeping disabled. | 260 // Confirms that magnifier is keeping disabled. |
258 EXPECT_FALSE(IsMagnifierEnabled()); | 261 EXPECT_FALSE(IsMagnifierEnabled()); |
259 | 262 |
260 UserManager::Get()->SessionStarted(); | 263 user_manager::UserManager::Get()->SessionStarted(); |
261 | 264 |
262 // Confirms that the magnifier is enabled and configured according to the | 265 // Confirms that the magnifier is enabled and configured according to the |
263 // explicitly set prefs just after session start. | 266 // explicitly set prefs just after session start. |
264 EXPECT_TRUE(IsMagnifierEnabled()); | 267 EXPECT_TRUE(IsMagnifierEnabled()); |
265 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 268 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
266 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 269 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
267 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 270 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
268 } | 271 } |
269 | 272 |
270 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { | 273 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { |
271 // Create a new profile once, to run the test with non-new profile. | 274 // Create a new profile once, to run the test with non-new profile. |
272 PrepareNonNewProfile(kTestUserName); | 275 PrepareNonNewProfile(kTestUserName); |
273 | 276 |
274 // Sets prefs to explicitly enable the magnifier. | 277 // Sets prefs to explicitly enable the magnifier. |
275 SetScreenMagnifierEnabledPref(true); | 278 SetScreenMagnifierEnabledPref(true); |
276 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); | 279 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); |
277 SetFullScreenMagnifierScalePref(2.5); | 280 SetFullScreenMagnifierScalePref(2.5); |
278 } | 281 } |
279 | 282 |
280 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { | 283 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
281 // Enables magnifier on login screen. | 284 // Enables magnifier on login screen. |
282 SetMagnifierType(ash::MAGNIFIER_FULL); | 285 SetMagnifierType(ash::MAGNIFIER_FULL); |
283 SetMagnifierEnabled(true); | 286 SetMagnifierEnabled(true); |
284 SetFullScreenMagnifierScale(3.0); | 287 SetFullScreenMagnifierScale(3.0); |
285 EXPECT_TRUE(IsMagnifierEnabled()); | 288 EXPECT_TRUE(IsMagnifierEnabled()); |
286 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 289 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
287 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); | 290 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); |
288 | 291 |
289 // Logs in (but the session is not started yet). | 292 // Logs in (but the session is not started yet). |
290 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 293 user_manager::UserManager::Get()->UserLoggedIn( |
| 294 kTestUserName, kTestUserName, true); |
291 | 295 |
292 // Confirms that magnifier is keeping enabled. | 296 // Confirms that magnifier is keeping enabled. |
293 EXPECT_TRUE(IsMagnifierEnabled()); | 297 EXPECT_TRUE(IsMagnifierEnabled()); |
294 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 298 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
295 | 299 |
296 UserManager::Get()->SessionStarted(); | 300 user_manager::UserManager::Get()->SessionStarted(); |
297 | 301 |
298 // Confirms that the magnifier is enabled and configured according to the | 302 // Confirms that the magnifier is enabled and configured according to the |
299 // explicitly set prefs just after session start. | 303 // explicitly set prefs just after session start. |
300 EXPECT_TRUE(IsMagnifierEnabled()); | 304 EXPECT_TRUE(IsMagnifierEnabled()); |
301 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 305 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
302 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 306 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
303 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 307 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
304 } | 308 } |
305 | 309 |
306 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { | 310 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { |
307 // Creates a new profile once, to run the test with non-new profile. | 311 // Creates a new profile once, to run the test with non-new profile. |
308 PrepareNonNewProfile(kTestUserName); | 312 PrepareNonNewProfile(kTestUserName); |
309 } | 313 } |
310 | 314 |
311 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { | 315 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
312 // Enables full screen magnifier. | 316 // Enables full screen magnifier. |
313 SetMagnifierType(ash::MAGNIFIER_FULL); | 317 SetMagnifierType(ash::MAGNIFIER_FULL); |
314 SetMagnifierEnabled(true); | 318 SetMagnifierEnabled(true); |
315 EXPECT_TRUE(IsMagnifierEnabled()); | 319 EXPECT_TRUE(IsMagnifierEnabled()); |
316 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 320 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
317 | 321 |
318 // Logs in (but the session is not started yet). | 322 // Logs in (but the session is not started yet). |
319 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 323 user_manager::UserManager::Get()->UserLoggedIn( |
| 324 kTestUserName, kTestUserName, true); |
320 | 325 |
321 // Confirms that magnifier is keeping enabled. | 326 // Confirms that magnifier is keeping enabled. |
322 EXPECT_TRUE(IsMagnifierEnabled()); | 327 EXPECT_TRUE(IsMagnifierEnabled()); |
323 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 328 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
324 | 329 |
325 UserManager::Get()->SessionStarted(); | 330 user_manager::UserManager::Get()->SessionStarted(); |
326 | 331 |
327 // Confirms that magnifier is disabled. | 332 // Confirms that magnifier is disabled. |
328 EXPECT_FALSE(IsMagnifierEnabled()); | 333 EXPECT_FALSE(IsMagnifierEnabled()); |
329 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 334 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
330 } | 335 } |
331 | 336 |
332 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { | 337 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { |
333 // Confirms that magnifier is disabled on the login screen. | 338 // Confirms that magnifier is disabled on the login screen. |
334 EXPECT_FALSE(IsMagnifierEnabled()); | 339 EXPECT_FALSE(IsMagnifierEnabled()); |
335 | 340 |
336 // Disables magnifier on login screen explicitly. | 341 // Disables magnifier on login screen explicitly. |
337 SetMagnifierEnabled(false); | 342 SetMagnifierEnabled(false); |
338 | 343 |
339 // Logs in (but the session is not started yet). | 344 // Logs in (but the session is not started yet). |
340 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 345 user_manager::UserManager::Get()->UserLoggedIn( |
| 346 kTestUserName, kTestUserName, true); |
341 | 347 |
342 // Confirms that magnifier is keeping disabled. | 348 // Confirms that magnifier is keeping disabled. |
343 EXPECT_FALSE(IsMagnifierEnabled()); | 349 EXPECT_FALSE(IsMagnifierEnabled()); |
344 | 350 |
345 UserManager::Get()->SessionStarted(); | 351 user_manager::UserManager::Get()->SessionStarted(); |
346 | 352 |
347 // Confirms that magnifier is keeping disabled. | 353 // Confirms that magnifier is keeping disabled. |
348 EXPECT_FALSE(IsMagnifierEnabled()); | 354 EXPECT_FALSE(IsMagnifierEnabled()); |
349 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 355 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
350 } | 356 } |
351 | 357 |
352 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { | 358 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { |
353 // Enables magnifier on login screen. | 359 // Enables magnifier on login screen. |
354 SetMagnifierType(ash::MAGNIFIER_FULL); | 360 SetMagnifierType(ash::MAGNIFIER_FULL); |
355 SetMagnifierEnabled(true); | 361 SetMagnifierEnabled(true); |
356 SetFullScreenMagnifierScale(2.5); | 362 SetFullScreenMagnifierScale(2.5); |
357 EXPECT_TRUE(IsMagnifierEnabled()); | 363 EXPECT_TRUE(IsMagnifierEnabled()); |
358 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 364 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
359 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 365 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
360 | 366 |
361 // Logs in (but the session is not started yet). | 367 // Logs in (but the session is not started yet). |
362 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 368 user_manager::UserManager::Get()->UserLoggedIn( |
| 369 kTestUserName, kTestUserName, true); |
363 | 370 |
364 // Confirms that magnifier is keeping enabled. | 371 // Confirms that magnifier is keeping enabled. |
365 EXPECT_TRUE(IsMagnifierEnabled()); | 372 EXPECT_TRUE(IsMagnifierEnabled()); |
366 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 373 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
367 | 374 |
368 UserManager::Get()->SessionStarted(); | 375 user_manager::UserManager::Get()->SessionStarted(); |
369 | 376 |
370 // Confirms that magnifier keeps enabled. | 377 // Confirms that magnifier keeps enabled. |
371 EXPECT_TRUE(IsMagnifierEnabled()); | 378 EXPECT_TRUE(IsMagnifierEnabled()); |
372 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 379 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
373 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 380 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
374 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 381 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
375 } | 382 } |
376 | 383 |
377 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { | 384 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { |
378 // Confirms that magnifier is disabled on the login screen. | 385 // Confirms that magnifier is disabled on the login screen. |
379 EXPECT_FALSE(IsMagnifierEnabled()); | 386 EXPECT_FALSE(IsMagnifierEnabled()); |
380 | 387 |
381 // Logs in (but the session is not started yet). | 388 // Logs in (but the session is not started yet). |
382 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 389 user_manager::UserManager::Get()->UserLoggedIn( |
| 390 kTestUserName, kTestUserName, true); |
383 | 391 |
384 // Confirms that magnifier is keeping disabled. | 392 // Confirms that magnifier is keeping disabled. |
385 EXPECT_FALSE(IsMagnifierEnabled()); | 393 EXPECT_FALSE(IsMagnifierEnabled()); |
386 | 394 |
387 UserManager::Get()->SessionStarted(); | 395 user_manager::UserManager::Get()->SessionStarted(); |
388 | 396 |
389 // Confirms that magnifier is keeping disabled. | 397 // Confirms that magnifier is keeping disabled. |
390 EXPECT_FALSE(IsMagnifierEnabled()); | 398 EXPECT_FALSE(IsMagnifierEnabled()); |
391 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 399 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
392 } | 400 } |
393 | 401 |
394 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) { | 402 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) { |
395 // Enables/disables full screen magnifier. | 403 // Enables/disables full screen magnifier. |
396 SetMagnifierEnabled(false); | 404 SetMagnifierEnabled(false); |
397 SetMagnifierType(ash::MAGNIFIER_FULL); | 405 SetMagnifierType(ash::MAGNIFIER_FULL); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 EXPECT_FALSE(IsMagnifierEnabled()); | 451 EXPECT_FALSE(IsMagnifierEnabled()); |
444 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 452 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
445 | 453 |
446 SetMagnifierType(ash::MAGNIFIER_FULL); | 454 SetMagnifierType(ash::MAGNIFIER_FULL); |
447 EXPECT_FALSE(IsMagnifierEnabled()); | 455 EXPECT_FALSE(IsMagnifierEnabled()); |
448 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 456 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
449 } | 457 } |
450 | 458 |
451 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { | 459 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { |
452 // Logs in | 460 // Logs in |
453 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 461 user_manager::UserManager::Get()->UserLoggedIn( |
454 UserManager::Get()->SessionStarted(); | 462 kTestUserName, kTestUserName, true); |
| 463 user_manager::UserManager::Get()->SessionStarted(); |
455 | 464 |
456 // Confirms that magnifier is disabled just after login. | 465 // Confirms that magnifier is disabled just after login. |
457 EXPECT_FALSE(IsMagnifierEnabled()); | 466 EXPECT_FALSE(IsMagnifierEnabled()); |
458 | 467 |
459 // Sets the pref as true to enable magnifier. | 468 // Sets the pref as true to enable magnifier. |
460 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); | 469 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); |
461 SetScreenMagnifierEnabledPref(true); | 470 SetScreenMagnifierEnabledPref(true); |
462 // Confirms that magnifier is enabled. | 471 // Confirms that magnifier is enabled. |
463 EXPECT_TRUE(IsMagnifierEnabled()); | 472 EXPECT_TRUE(IsMagnifierEnabled()); |
464 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); | 473 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 observer.reset(); | 543 observer.reset(); |
535 | 544 |
536 // Set full screen magnifier again, and confirm the observer is not called. | 545 // Set full screen magnifier again, and confirm the observer is not called. |
537 SetMagnifierType(ash::MAGNIFIER_FULL); | 546 SetMagnifierType(ash::MAGNIFIER_FULL); |
538 EXPECT_FALSE(observer.observed()); | 547 EXPECT_FALSE(observer.observed()); |
539 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); | 548 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); |
540 observer.reset(); | 549 observer.reset(); |
541 } | 550 } |
542 | 551 |
543 } // namespace chromeos | 552 } // namespace chromeos |
OLD | NEW |