Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc

Issue 682943002: Make chrome/browser/chromeos/accessibility compile on Athena with use_ash=0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash41_scroll_end_effect
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
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";
35 35
36 void SetMagnifierEnabled(bool enabled) { 36 void SetMagnifierEnabled(bool enabled) {
37 MagnificationManager::Get()->SetMagnifierEnabled(enabled); 37 MagnificationManager::Get()->SetMagnifierEnabled(enabled);
38 } 38 }
39 39
40 void SetMagnifierType(ash::MagnifierType type) { 40 void SetMagnifierType(ui::MagnifierType type) {
41 MagnificationManager::Get()->SetMagnifierType(type); 41 MagnificationManager::Get()->SetMagnifierType(type);
42 } 42 }
43 43
44 void SetFullScreenMagnifierScale(double scale) { 44 void SetFullScreenMagnifierScale(double scale) {
45 ash::Shell::GetInstance()-> 45 ash::Shell::GetInstance()->
46 magnification_controller()->SetScale(scale, false); 46 magnification_controller()->SetScale(scale, false);
47 } 47 }
48 48
49 double GetFullScreenMagnifierScale() { 49 double GetFullScreenMagnifierScale() {
50 return ash::Shell::GetInstance()->magnification_controller()->GetScale(); 50 return ash::Shell::GetInstance()->magnification_controller()->GetScale();
51 } 51 }
52 52
53 void SetSavedFullScreenMagnifierScale(double scale) { 53 void SetSavedFullScreenMagnifierScale(double scale) {
54 MagnificationManager::Get()->SaveScreenMagnifierScale(scale); 54 MagnificationManager::Get()->SaveScreenMagnifierScale(scale);
55 } 55 }
56 56
57 double GetSavedFullScreenMagnifierScale() { 57 double GetSavedFullScreenMagnifierScale() {
58 return MagnificationManager::Get()->GetSavedScreenMagnifierScale(); 58 return MagnificationManager::Get()->GetSavedScreenMagnifierScale();
59 } 59 }
60 60
61 ash::MagnifierType GetMagnifierType() { 61 ui::MagnifierType GetMagnifierType() {
62 return MagnificationManager::Get()->GetMagnifierType(); 62 return MagnificationManager::Get()->GetMagnifierType();
63 } 63 }
64 64
65 bool IsMagnifierEnabled() { 65 bool IsMagnifierEnabled() {
66 return MagnificationManager::Get()->IsMagnifierEnabled(); 66 return MagnificationManager::Get()->IsMagnifierEnabled();
67 } 67 }
68 68
69 Profile* profile() { 69 Profile* profile() {
70 Profile* profile = ProfileManager::GetActiveUserProfile(); 70 Profile* profile = ProfileManager::GetActiveUserProfile();
71 DCHECK(profile); 71 DCHECK(profile);
72 return profile; 72 return profile;
73 } 73 }
74 74
75 PrefService* prefs() { 75 PrefService* prefs() {
76 return user_prefs::UserPrefs::Get(profile()); 76 return user_prefs::UserPrefs::Get(profile());
77 } 77 }
78 78
79 void SetScreenMagnifierEnabledPref(bool enabled) { 79 void SetScreenMagnifierEnabledPref(bool enabled) {
80 prefs()->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, enabled); 80 prefs()->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, enabled);
81 } 81 }
82 82
83 void SetScreenMagnifierTypePref(ash::MagnifierType type) { 83 void SetScreenMagnifierTypePref(ui::MagnifierType type) {
84 prefs()->SetInteger(prefs::kAccessibilityScreenMagnifierType, type); 84 prefs()->SetInteger(prefs::kAccessibilityScreenMagnifierType, type);
85 } 85 }
86 86
87 void SetFullScreenMagnifierScalePref(double scale) { 87 void SetFullScreenMagnifierScalePref(double scale) {
88 prefs()->SetDouble(prefs::kAccessibilityScreenMagnifierScale, scale); 88 prefs()->SetDouble(prefs::kAccessibilityScreenMagnifierScale, scale);
89 } 89 }
90 90
91 bool GetScreenMagnifierEnabledFromPref() { 91 bool GetScreenMagnifierEnabledFromPref() {
92 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); 92 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled);
93 } 93 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 user_manager::UserManager::Get()->SessionStarted(); 193 user_manager::UserManager::Get()->SessionStarted();
194 194
195 // Confirms that magnifier is still disabled just after session starts. 195 // Confirms that magnifier is still disabled just after session starts.
196 EXPECT_FALSE(IsMagnifierEnabled()); 196 EXPECT_FALSE(IsMagnifierEnabled());
197 197
198 // Enables magnifier. 198 // Enables magnifier.
199 SetMagnifierEnabled(true); 199 SetMagnifierEnabled(true);
200 // Confirms that magnifier is enabled. 200 // Confirms that magnifier is enabled.
201 EXPECT_TRUE(IsMagnifierEnabled()); 201 EXPECT_TRUE(IsMagnifierEnabled());
202 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 202 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
203 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 203 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
204 } 204 }
205 205
206 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { 206 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) {
207 // Create a new profile once, to run the test with non-new profile. 207 // Create a new profile once, to run the test with non-new profile.
208 PrepareNonNewProfile(kTestUserName); 208 PrepareNonNewProfile(kTestUserName);
209 209
210 // Sets pref to explicitly disable the magnifier. 210 // Sets pref to explicitly disable the magnifier.
211 SetScreenMagnifierEnabledPref(false); 211 SetScreenMagnifierEnabledPref(false);
212 } 212 }
213 213
214 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { 214 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) {
215 // Confirms that magnifier is disabled on the login screen. 215 // Confirms that magnifier is disabled on the login screen.
216 EXPECT_FALSE(IsMagnifierEnabled()); 216 EXPECT_FALSE(IsMagnifierEnabled());
217 217
218 // Enables magnifier on login screen. 218 // Enables magnifier on login screen.
219 SetMagnifierEnabled(true); 219 SetMagnifierEnabled(true);
220 SetMagnifierType(ash::MAGNIFIER_FULL); 220 SetMagnifierType(ui::MAGNIFIER_FULL);
221 SetFullScreenMagnifierScale(2.5); 221 SetFullScreenMagnifierScale(2.5);
222 EXPECT_TRUE(IsMagnifierEnabled()); 222 EXPECT_TRUE(IsMagnifierEnabled());
223 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 223 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
224 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 224 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
225 225
226 // Logs in (but the session is not started yet). 226 // Logs in (but the session is not started yet).
227 user_manager::UserManager::Get()->UserLoggedIn( 227 user_manager::UserManager::Get()->UserLoggedIn(
228 kTestUserName, kTestUserName, true); 228 kTestUserName, kTestUserName, true);
229 229
230 // Confirms that magnifier is keeping enabled. 230 // Confirms that magnifier is keeping enabled.
231 EXPECT_TRUE(IsMagnifierEnabled()); 231 EXPECT_TRUE(IsMagnifierEnabled());
232 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 232 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
233 233
234 user_manager::UserManager::Get()->SessionStarted(); 234 user_manager::UserManager::Get()->SessionStarted();
235 235
236 // Confirms that magnifier is disabled just after session start. 236 // Confirms that magnifier is disabled just after session start.
237 EXPECT_FALSE(IsMagnifierEnabled()); 237 EXPECT_FALSE(IsMagnifierEnabled());
238 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 238 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
239 } 239 }
240 240
241 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { 241 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) {
242 // 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.
243 PrepareNonNewProfile(kTestUserName); 243 PrepareNonNewProfile(kTestUserName);
244 244
245 // Sets prefs to explicitly enable the magnifier. 245 // Sets prefs to explicitly enable the magnifier.
246 SetScreenMagnifierEnabledPref(true); 246 SetScreenMagnifierEnabledPref(true);
247 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); 247 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL);
248 SetFullScreenMagnifierScalePref(2.5); 248 SetFullScreenMagnifierScalePref(2.5);
249 } 249 }
250 250
251 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { 251 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) {
252 // Disables magnifier on login screen. 252 // Disables magnifier on login screen.
253 SetMagnifierEnabled(false); 253 SetMagnifierEnabled(false);
254 EXPECT_FALSE(IsMagnifierEnabled()); 254 EXPECT_FALSE(IsMagnifierEnabled());
255 255
256 // Logs in (but the session is not started yet). 256 // Logs in (but the session is not started yet).
257 user_manager::UserManager::Get()->UserLoggedIn( 257 user_manager::UserManager::Get()->UserLoggedIn(
258 kTestUserName, kTestUserName, true); 258 kTestUserName, kTestUserName, true);
259 259
260 // Confirms that magnifier is keeping disabled. 260 // Confirms that magnifier is keeping disabled.
261 EXPECT_FALSE(IsMagnifierEnabled()); 261 EXPECT_FALSE(IsMagnifierEnabled());
262 262
263 user_manager::UserManager::Get()->SessionStarted(); 263 user_manager::UserManager::Get()->SessionStarted();
264 264
265 // Confirms that the magnifier is enabled and configured according to the 265 // Confirms that the magnifier is enabled and configured according to the
266 // explicitly set prefs just after session start. 266 // explicitly set prefs just after session start.
267 EXPECT_TRUE(IsMagnifierEnabled()); 267 EXPECT_TRUE(IsMagnifierEnabled());
268 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 268 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
269 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 269 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
270 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 270 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
271 } 271 }
272 272
273 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { 273 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) {
274 // 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.
275 PrepareNonNewProfile(kTestUserName); 275 PrepareNonNewProfile(kTestUserName);
276 276
277 // Sets prefs to explicitly enable the magnifier. 277 // Sets prefs to explicitly enable the magnifier.
278 SetScreenMagnifierEnabledPref(true); 278 SetScreenMagnifierEnabledPref(true);
279 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); 279 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL);
280 SetFullScreenMagnifierScalePref(2.5); 280 SetFullScreenMagnifierScalePref(2.5);
281 } 281 }
282 282
283 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { 283 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
284 // Enables magnifier on login screen. 284 // Enables magnifier on login screen.
285 SetMagnifierType(ash::MAGNIFIER_FULL); 285 SetMagnifierType(ui::MAGNIFIER_FULL);
286 SetMagnifierEnabled(true); 286 SetMagnifierEnabled(true);
287 SetFullScreenMagnifierScale(3.0); 287 SetFullScreenMagnifierScale(3.0);
288 EXPECT_TRUE(IsMagnifierEnabled()); 288 EXPECT_TRUE(IsMagnifierEnabled());
289 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 289 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
290 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); 290 EXPECT_EQ(3.0, GetFullScreenMagnifierScale());
291 291
292 // Logs in (but the session is not started yet). 292 // Logs in (but the session is not started yet).
293 user_manager::UserManager::Get()->UserLoggedIn( 293 user_manager::UserManager::Get()->UserLoggedIn(
294 kTestUserName, kTestUserName, true); 294 kTestUserName, kTestUserName, true);
295 295
296 // Confirms that magnifier is keeping enabled. 296 // Confirms that magnifier is keeping enabled.
297 EXPECT_TRUE(IsMagnifierEnabled()); 297 EXPECT_TRUE(IsMagnifierEnabled());
298 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 298 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
299 299
300 user_manager::UserManager::Get()->SessionStarted(); 300 user_manager::UserManager::Get()->SessionStarted();
301 301
302 // Confirms that the magnifier is enabled and configured according to the 302 // Confirms that the magnifier is enabled and configured according to the
303 // explicitly set prefs just after session start. 303 // explicitly set prefs just after session start.
304 EXPECT_TRUE(IsMagnifierEnabled()); 304 EXPECT_TRUE(IsMagnifierEnabled());
305 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 305 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
306 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 306 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
307 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 307 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
308 } 308 }
309 309
310 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { 310 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) {
311 // 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.
312 PrepareNonNewProfile(kTestUserName); 312 PrepareNonNewProfile(kTestUserName);
313 } 313 }
314 314
315 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { 315 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) {
316 // Enables full screen magnifier. 316 // Enables full screen magnifier.
317 SetMagnifierType(ash::MAGNIFIER_FULL); 317 SetMagnifierType(ui::MAGNIFIER_FULL);
318 SetMagnifierEnabled(true); 318 SetMagnifierEnabled(true);
319 EXPECT_TRUE(IsMagnifierEnabled()); 319 EXPECT_TRUE(IsMagnifierEnabled());
320 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 320 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
321 321
322 // Logs in (but the session is not started yet). 322 // Logs in (but the session is not started yet).
323 user_manager::UserManager::Get()->UserLoggedIn( 323 user_manager::UserManager::Get()->UserLoggedIn(
324 kTestUserName, kTestUserName, true); 324 kTestUserName, kTestUserName, true);
325 325
326 // Confirms that magnifier is keeping enabled. 326 // Confirms that magnifier is keeping enabled.
327 EXPECT_TRUE(IsMagnifierEnabled()); 327 EXPECT_TRUE(IsMagnifierEnabled());
328 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 328 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
329 329
330 user_manager::UserManager::Get()->SessionStarted(); 330 user_manager::UserManager::Get()->SessionStarted();
331 331
332 // Confirms that magnifier is disabled. 332 // Confirms that magnifier is disabled.
333 EXPECT_FALSE(IsMagnifierEnabled()); 333 EXPECT_FALSE(IsMagnifierEnabled());
334 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 334 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
335 } 335 }
336 336
337 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { 337 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) {
338 // Confirms that magnifier is disabled on the login screen. 338 // Confirms that magnifier is disabled on the login screen.
(...skipping 11 matching lines...) Expand all
350 350
351 user_manager::UserManager::Get()->SessionStarted(); 351 user_manager::UserManager::Get()->SessionStarted();
352 352
353 // Confirms that magnifier is keeping disabled. 353 // Confirms that magnifier is keeping disabled.
354 EXPECT_FALSE(IsMagnifierEnabled()); 354 EXPECT_FALSE(IsMagnifierEnabled());
355 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 355 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
356 } 356 }
357 357
358 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { 358 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) {
359 // Enables magnifier on login screen. 359 // Enables magnifier on login screen.
360 SetMagnifierType(ash::MAGNIFIER_FULL); 360 SetMagnifierType(ui::MAGNIFIER_FULL);
361 SetMagnifierEnabled(true); 361 SetMagnifierEnabled(true);
362 SetFullScreenMagnifierScale(2.5); 362 SetFullScreenMagnifierScale(2.5);
363 EXPECT_TRUE(IsMagnifierEnabled()); 363 EXPECT_TRUE(IsMagnifierEnabled());
364 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 364 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
365 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 365 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
366 366
367 // Logs in (but the session is not started yet). 367 // Logs in (but the session is not started yet).
368 user_manager::UserManager::Get()->UserLoggedIn( 368 user_manager::UserManager::Get()->UserLoggedIn(
369 kTestUserName, kTestUserName, true); 369 kTestUserName, kTestUserName, true);
370 370
371 // Confirms that magnifier is keeping enabled. 371 // Confirms that magnifier is keeping enabled.
372 EXPECT_TRUE(IsMagnifierEnabled()); 372 EXPECT_TRUE(IsMagnifierEnabled());
373 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 373 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
374 374
375 user_manager::UserManager::Get()->SessionStarted(); 375 user_manager::UserManager::Get()->SessionStarted();
376 376
377 // Confirms that magnifier keeps enabled. 377 // Confirms that magnifier keeps enabled.
378 EXPECT_TRUE(IsMagnifierEnabled()); 378 EXPECT_TRUE(IsMagnifierEnabled());
379 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 379 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
380 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 380 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
381 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 381 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
382 } 382 }
383 383
384 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { 384 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) {
385 // Confirms that magnifier is disabled on the login screen. 385 // Confirms that magnifier is disabled on the login screen.
386 EXPECT_FALSE(IsMagnifierEnabled()); 386 EXPECT_FALSE(IsMagnifierEnabled());
387 387
388 // Logs in (but the session is not started yet). 388 // Logs in (but the session is not started yet).
389 user_manager::UserManager::Get()->UserLoggedIn( 389 user_manager::UserManager::Get()->UserLoggedIn(
390 kTestUserName, kTestUserName, true); 390 kTestUserName, kTestUserName, true);
391 391
392 // Confirms that magnifier is keeping disabled. 392 // Confirms that magnifier is keeping disabled.
393 EXPECT_FALSE(IsMagnifierEnabled()); 393 EXPECT_FALSE(IsMagnifierEnabled());
394 394
395 user_manager::UserManager::Get()->SessionStarted(); 395 user_manager::UserManager::Get()->SessionStarted();
396 396
397 // Confirms that magnifier is keeping disabled. 397 // Confirms that magnifier is keeping disabled.
398 EXPECT_FALSE(IsMagnifierEnabled()); 398 EXPECT_FALSE(IsMagnifierEnabled());
399 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 399 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
400 } 400 }
401 401
402 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) { 402 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) {
403 // Enables/disables full screen magnifier. 403 // Enables/disables full screen magnifier.
404 SetMagnifierEnabled(false); 404 SetMagnifierEnabled(false);
405 SetMagnifierType(ash::MAGNIFIER_FULL); 405 SetMagnifierType(ui::MAGNIFIER_FULL);
406 EXPECT_FALSE(IsMagnifierEnabled()); 406 EXPECT_FALSE(IsMagnifierEnabled());
407 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 407 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
408 408
409 SetMagnifierEnabled(true); 409 SetMagnifierEnabled(true);
410 EXPECT_TRUE(IsMagnifierEnabled()); 410 EXPECT_TRUE(IsMagnifierEnabled());
411 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 411 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
412 412
413 SetMagnifierEnabled(false); 413 SetMagnifierEnabled(false);
414 EXPECT_FALSE(IsMagnifierEnabled()); 414 EXPECT_FALSE(IsMagnifierEnabled());
415 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 415 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
416 416
417 // Enables/disables partial screen magnifier. 417 // Enables/disables partial screen magnifier.
418 SetMagnifierType(ash::MAGNIFIER_PARTIAL); 418 SetMagnifierType(ui::MAGNIFIER_PARTIAL);
419 EXPECT_FALSE(IsMagnifierEnabled()); 419 EXPECT_FALSE(IsMagnifierEnabled());
420 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 420 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
421 421
422 SetMagnifierEnabled(true); 422 SetMagnifierEnabled(true);
423 EXPECT_TRUE(IsMagnifierEnabled()); 423 EXPECT_TRUE(IsMagnifierEnabled());
424 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 424 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
425 425
426 SetMagnifierEnabled(false); 426 SetMagnifierEnabled(false);
427 EXPECT_FALSE(IsMagnifierEnabled()); 427 EXPECT_FALSE(IsMagnifierEnabled());
428 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 428 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
429 429
430 // Changes the magnifier type when the magnifier is enabled. 430 // Changes the magnifier type when the magnifier is enabled.
431 SetMagnifierType(ash::MAGNIFIER_FULL); 431 SetMagnifierType(ui::MAGNIFIER_FULL);
432 SetMagnifierEnabled(true); 432 SetMagnifierEnabled(true);
433 EXPECT_TRUE(IsMagnifierEnabled()); 433 EXPECT_TRUE(IsMagnifierEnabled());
434 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 434 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
435 435
436 SetMagnifierType(ash::MAGNIFIER_PARTIAL); 436 SetMagnifierType(ui::MAGNIFIER_PARTIAL);
437 EXPECT_TRUE(IsMagnifierEnabled()); 437 EXPECT_TRUE(IsMagnifierEnabled());
438 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 438 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
439 439
440 SetMagnifierType(ash::MAGNIFIER_FULL); 440 SetMagnifierType(ui::MAGNIFIER_FULL);
441 EXPECT_TRUE(IsMagnifierEnabled()); 441 EXPECT_TRUE(IsMagnifierEnabled());
442 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 442 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
443 443
444 // Changes the magnifier type when the magnifier is disabled. 444 // Changes the magnifier type when the magnifier is disabled.
445 SetMagnifierEnabled(false); 445 SetMagnifierEnabled(false);
446 SetMagnifierType(ash::MAGNIFIER_FULL); 446 SetMagnifierType(ui::MAGNIFIER_FULL);
447 EXPECT_FALSE(IsMagnifierEnabled()); 447 EXPECT_FALSE(IsMagnifierEnabled());
448 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 448 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
449 449
450 SetMagnifierType(ash::MAGNIFIER_PARTIAL); 450 SetMagnifierType(ui::MAGNIFIER_PARTIAL);
451 EXPECT_FALSE(IsMagnifierEnabled()); 451 EXPECT_FALSE(IsMagnifierEnabled());
452 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 452 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
453 453
454 SetMagnifierType(ash::MAGNIFIER_FULL); 454 SetMagnifierType(ui::MAGNIFIER_FULL);
455 EXPECT_FALSE(IsMagnifierEnabled()); 455 EXPECT_FALSE(IsMagnifierEnabled());
456 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 456 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
457 } 457 }
458 458
459 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { 459 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
460 // Logs in 460 // Logs in
461 user_manager::UserManager::Get()->UserLoggedIn( 461 user_manager::UserManager::Get()->UserLoggedIn(
462 kTestUserName, kTestUserName, true); 462 kTestUserName, kTestUserName, true);
463 user_manager::UserManager::Get()->SessionStarted(); 463 user_manager::UserManager::Get()->SessionStarted();
464 464
465 // Confirms that magnifier is disabled just after login. 465 // Confirms that magnifier is disabled just after login.
466 EXPECT_FALSE(IsMagnifierEnabled()); 466 EXPECT_FALSE(IsMagnifierEnabled());
467 467
468 // Sets the pref as true to enable magnifier. 468 // Sets the pref as true to enable magnifier.
469 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); 469 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL);
470 SetScreenMagnifierEnabledPref(true); 470 SetScreenMagnifierEnabledPref(true);
471 // Confirms that magnifier is enabled. 471 // Confirms that magnifier is enabled.
472 EXPECT_TRUE(IsMagnifierEnabled()); 472 EXPECT_TRUE(IsMagnifierEnabled());
473 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 473 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
474 } 474 }
475 475
476 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) { 476 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
477 SetMagnifierEnabled(false); 477 SetMagnifierEnabled(false);
478 EXPECT_FALSE(IsMagnifierEnabled()); 478 EXPECT_FALSE(IsMagnifierEnabled());
479 479
480 // Sets 2.5x to the pref. 480 // Sets 2.5x to the pref.
481 SetSavedFullScreenMagnifierScale(2.5); 481 SetSavedFullScreenMagnifierScale(2.5);
482 482
483 // Enables full screen magnifier. 483 // Enables full screen magnifier.
484 SetMagnifierType(ash::MAGNIFIER_FULL); 484 SetMagnifierType(ui::MAGNIFIER_FULL);
485 SetMagnifierEnabled(true); 485 SetMagnifierEnabled(true);
486 EXPECT_TRUE(IsMagnifierEnabled()); 486 EXPECT_TRUE(IsMagnifierEnabled());
487 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 487 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
488 488
489 // Confirms that 2.5x is restored. 489 // Confirms that 2.5x is restored.
490 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 490 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
491 491
492 // Sets the scale and confirms that the scale is saved to pref. 492 // Sets the scale and confirms that the scale is saved to pref.
493 SetFullScreenMagnifierScale(3.0); 493 SetFullScreenMagnifierScale(3.0);
494 EXPECT_EQ(3.0, GetSavedFullScreenMagnifierScale()); 494 EXPECT_EQ(3.0, GetSavedFullScreenMagnifierScale());
495 } 495 }
496 496
497 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) { 497 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) {
498 // TEST 1: Sets too small scale 498 // TEST 1: Sets too small scale
499 SetMagnifierEnabled(false); 499 SetMagnifierEnabled(false);
500 EXPECT_FALSE(IsMagnifierEnabled()); 500 EXPECT_FALSE(IsMagnifierEnabled());
501 501
502 // Sets too small value to the pref. 502 // Sets too small value to the pref.
503 SetSavedFullScreenMagnifierScale(0.5); 503 SetSavedFullScreenMagnifierScale(0.5);
504 504
505 // Enables full screen magnifier. 505 // Enables full screen magnifier.
506 SetMagnifierType(ash::MAGNIFIER_FULL); 506 SetMagnifierType(ui::MAGNIFIER_FULL);
507 SetMagnifierEnabled(true); 507 SetMagnifierEnabled(true);
508 EXPECT_TRUE(IsMagnifierEnabled()); 508 EXPECT_TRUE(IsMagnifierEnabled());
509 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 509 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
510 510
511 // Confirms that the actual scale is set to the minimum scale. 511 // Confirms that the actual scale is set to the minimum scale.
512 EXPECT_EQ(1.0, GetFullScreenMagnifierScale()); 512 EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
513 513
514 // TEST 2: Sets too large scale 514 // TEST 2: Sets too large scale
515 SetMagnifierEnabled(false); 515 SetMagnifierEnabled(false);
516 EXPECT_FALSE(IsMagnifierEnabled()); 516 EXPECT_FALSE(IsMagnifierEnabled());
517 517
518 // Sets too large value to the pref. 518 // Sets too large value to the pref.
519 SetSavedFullScreenMagnifierScale(50.0); 519 SetSavedFullScreenMagnifierScale(50.0);
520 520
521 // Enables full screen magnifier. 521 // Enables full screen magnifier.
522 SetMagnifierEnabled(true); 522 SetMagnifierEnabled(true);
523 EXPECT_TRUE(IsMagnifierEnabled()); 523 EXPECT_TRUE(IsMagnifierEnabled());
524 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 524 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType());
525 525
526 // Confirms that the actual scale is set to the maximum scale. 526 // Confirms that the actual scale is set to the maximum scale.
527 EXPECT_EQ(4.0, GetFullScreenMagnifierScale()); 527 EXPECT_EQ(4.0, GetFullScreenMagnifierScale());
528 } 528 }
529 529
530 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, 530 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest,
531 ChangingTypeInvokesNotification) { 531 ChangingTypeInvokesNotification) {
532 MockMagnificationObserver observer; 532 MockMagnificationObserver observer;
533 533
534 EXPECT_FALSE(observer.observed()); 534 EXPECT_FALSE(observer.observed());
535 535
536 // Set full screen magnifier, and confirm the observer is called. 536 // Set full screen magnifier, and confirm the observer is called.
537 SetMagnifierEnabled(true); 537 SetMagnifierEnabled(true);
538 SetMagnifierType(ash::MAGNIFIER_FULL); 538 SetMagnifierType(ui::MAGNIFIER_FULL);
539 EXPECT_TRUE(observer.observed()); 539 EXPECT_TRUE(observer.observed());
540 EXPECT_TRUE(observer.observed_enabled()); 540 EXPECT_TRUE(observer.observed_enabled());
541 EXPECT_EQ(observer.magnifier_type(), ash::MAGNIFIER_FULL); 541 EXPECT_EQ(observer.magnifier_type(), ui::MAGNIFIER_FULL);
542 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); 542 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL);
543 observer.reset(); 543 observer.reset();
544 544
545 // 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.
546 SetMagnifierType(ash::MAGNIFIER_FULL); 546 SetMagnifierType(ui::MAGNIFIER_FULL);
547 EXPECT_FALSE(observer.observed()); 547 EXPECT_FALSE(observer.observed());
548 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); 548 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL);
549 observer.reset(); 549 observer.reset();
550 } 550 }
551 551
552 } // namespace chromeos 552 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698