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

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

Issue 2468483002: session_manager: Tracks user sessions (Closed)
Patch Set: replace func overload with better names Created 4 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/common/accessibility_types.h" 7 #include "ash/common/accessibility_types.h"
8 #include "ash/magnifier/magnification_controller.h" 8 #include "ash/magnifier/magnification_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 15 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
16 #include "chrome/browser/chromeos/login/helper.h" 16 #include "chrome/browser/chromeos/login/helper.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "chromeos/chromeos_switches.h" 23 #include "chromeos/chromeos_switches.h"
24 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
25 #include "components/session_manager/core/session_manager.h" 25 #include "components/session_manager/core/session_manager.h"
26 #include "components/user_manager/user_manager.h"
27 #include "components/user_prefs/user_prefs.h" 26 #include "components/user_prefs/user_prefs.h"
28 #include "content/public/browser/notification_details.h" 27 #include "content/public/browser/notification_details.h"
29 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
30 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
31 30
32 namespace chromeos { 31 namespace chromeos {
33 32
34 namespace { 33 namespace {
35 34
36 const char kTestUserName[] = "owner@invalid.domain"; 35 const char kTestUserName[] = "owner@invalid.domain";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 90 }
92 91
93 bool GetScreenMagnifierEnabledFromPref() { 92 bool GetScreenMagnifierEnabledFromPref() {
94 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled); 93 return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled);
95 } 94 }
96 95
97 // Creates and logs into a profile with account |account_id|, and makes sure 96 // Creates and logs into a profile with account |account_id|, and makes sure
98 // that the profile is regarded as "non new" in the next login. This is used in 97 // that the profile is regarded as "non new" in the next login. This is used in
99 // PRE_XXX cases so that in the main XXX case we can test non new profiles. 98 // PRE_XXX cases so that in the main XXX case we can test non new profiles.
100 void PrepareNonNewProfile(const AccountId& account_id) { 99 void PrepareNonNewProfile(const AccountId& account_id) {
101 user_manager::UserManager::Get()->UserLoggedIn( 100 session_manager::SessionManager::Get()->CreateSession(
102 account_id, account_id.GetUserEmail(), true); 101 account_id, account_id.GetUserEmail());
103 // To prepare a non-new profile for tests, we must ensure the profile 102 // To prepare a non-new profile for tests, we must ensure the profile
104 // directory and the preference files are created, because that's what 103 // directory and the preference files are created, because that's what
105 // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet 104 // Profile::IsNewProfile() checks. CreateSession(), however, does not yet
106 // create the profile directory until GetActiveUserProfile() is called. 105 // create the profile directory until GetActiveUserProfile() is called.
107 ProfileManager::GetActiveUserProfile(); 106 ProfileManager::GetActiveUserProfile();
108 } 107 }
109 108
110 } // namespace 109 } // namespace
111 110
112 class MockMagnificationObserver { 111 class MockMagnificationObserver {
113 public: 112 public:
114 MockMagnificationObserver() : observed_(false), 113 MockMagnificationObserver() : observed_(false),
115 observed_enabled_(false), 114 observed_enabled_(false),
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 181
183 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { 182 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) {
184 // Confirms that magnifier is disabled on the login screen. 183 // Confirms that magnifier is disabled on the login screen.
185 EXPECT_FALSE(IsMagnifierEnabled()); 184 EXPECT_FALSE(IsMagnifierEnabled());
186 185
187 // Disables magnifier on login screen. 186 // Disables magnifier on login screen.
188 SetMagnifierEnabled(false); 187 SetMagnifierEnabled(false);
189 EXPECT_FALSE(IsMagnifierEnabled()); 188 EXPECT_FALSE(IsMagnifierEnabled());
190 189
191 // Logs in with existing profile. 190 // Logs in with existing profile.
192 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 191 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
193 kTestUserName, true); 192 kTestUserName);
194 193
195 // Confirms that magnifier is still disabled just after login. 194 // Confirms that magnifier is still disabled just after login.
196 EXPECT_FALSE(IsMagnifierEnabled()); 195 EXPECT_FALSE(IsMagnifierEnabled());
197 196
198 session_manager::SessionManager::Get()->SessionStarted(); 197 session_manager::SessionManager::Get()->SessionStarted();
199 198
200 // Confirms that magnifier is still disabled just after session starts. 199 // Confirms that magnifier is still disabled just after session starts.
201 EXPECT_FALSE(IsMagnifierEnabled()); 200 EXPECT_FALSE(IsMagnifierEnabled());
202 201
203 // Enables magnifier. 202 // Enables magnifier.
(...skipping 18 matching lines...) Expand all
222 221
223 // Enables magnifier on login screen. 222 // Enables magnifier on login screen.
224 SetMagnifierEnabled(true); 223 SetMagnifierEnabled(true);
225 SetMagnifierType(ash::MAGNIFIER_FULL); 224 SetMagnifierType(ash::MAGNIFIER_FULL);
226 SetFullScreenMagnifierScale(2.5); 225 SetFullScreenMagnifierScale(2.5);
227 EXPECT_TRUE(IsMagnifierEnabled()); 226 EXPECT_TRUE(IsMagnifierEnabled());
228 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 227 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
229 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 228 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
230 229
231 // Logs in (but the session is not started yet). 230 // Logs in (but the session is not started yet).
232 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 231 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
233 kTestUserName, true); 232 kTestUserName);
234 233
235 // Confirms that magnifier is keeping enabled. 234 // Confirms that magnifier is keeping enabled.
236 EXPECT_TRUE(IsMagnifierEnabled()); 235 EXPECT_TRUE(IsMagnifierEnabled());
237 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 236 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
238 237
239 session_manager::SessionManager::Get()->SessionStarted(); 238 session_manager::SessionManager::Get()->SessionStarted();
240 239
241 // Confirms that magnifier is disabled just after session start. 240 // Confirms that magnifier is disabled just after session start.
242 EXPECT_FALSE(IsMagnifierEnabled()); 241 EXPECT_FALSE(IsMagnifierEnabled());
243 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 242 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
244 } 243 }
245 244
246 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { 245 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) {
247 // Create a new profile once, to run the test with non-new profile. 246 // Create a new profile once, to run the test with non-new profile.
248 PrepareNonNewProfile(test_account_id_); 247 PrepareNonNewProfile(test_account_id_);
249 248
250 // Sets prefs to explicitly enable the magnifier. 249 // Sets prefs to explicitly enable the magnifier.
251 SetScreenMagnifierEnabledPref(true); 250 SetScreenMagnifierEnabledPref(true);
252 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); 251 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL);
253 SetFullScreenMagnifierScalePref(2.5); 252 SetFullScreenMagnifierScalePref(2.5);
254 } 253 }
255 254
256 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { 255 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) {
257 // Disables magnifier on login screen. 256 // Disables magnifier on login screen.
258 SetMagnifierEnabled(false); 257 SetMagnifierEnabled(false);
259 EXPECT_FALSE(IsMagnifierEnabled()); 258 EXPECT_FALSE(IsMagnifierEnabled());
260 259
261 // Logs in (but the session is not started yet). 260 // Logs in (but the session is not started yet).
262 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 261 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
263 kTestUserName, true); 262 kTestUserName);
264 263
265 // Confirms that magnifier is keeping disabled. 264 // Confirms that magnifier is keeping disabled.
266 EXPECT_FALSE(IsMagnifierEnabled()); 265 EXPECT_FALSE(IsMagnifierEnabled());
267 266
268 session_manager::SessionManager::Get()->SessionStarted(); 267 session_manager::SessionManager::Get()->SessionStarted();
269 268
270 // Confirms that the magnifier is enabled and configured according to the 269 // Confirms that the magnifier is enabled and configured according to the
271 // explicitly set prefs just after session start. 270 // explicitly set prefs just after session start.
272 EXPECT_TRUE(IsMagnifierEnabled()); 271 EXPECT_TRUE(IsMagnifierEnabled());
273 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 272 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
(...skipping 14 matching lines...) Expand all
288 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { 287 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
289 // Enables magnifier on login screen. 288 // Enables magnifier on login screen.
290 SetMagnifierType(ash::MAGNIFIER_FULL); 289 SetMagnifierType(ash::MAGNIFIER_FULL);
291 SetMagnifierEnabled(true); 290 SetMagnifierEnabled(true);
292 SetFullScreenMagnifierScale(3.0); 291 SetFullScreenMagnifierScale(3.0);
293 EXPECT_TRUE(IsMagnifierEnabled()); 292 EXPECT_TRUE(IsMagnifierEnabled());
294 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 293 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
295 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); 294 EXPECT_EQ(3.0, GetFullScreenMagnifierScale());
296 295
297 // Logs in (but the session is not started yet). 296 // Logs in (but the session is not started yet).
298 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 297 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
299 kTestUserName, true); 298 kTestUserName);
300 299
301 // Confirms that magnifier is keeping enabled. 300 // Confirms that magnifier is keeping enabled.
302 EXPECT_TRUE(IsMagnifierEnabled()); 301 EXPECT_TRUE(IsMagnifierEnabled());
303 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 302 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
304 303
305 session_manager::SessionManager::Get()->SessionStarted(); 304 session_manager::SessionManager::Get()->SessionStarted();
306 305
307 // Confirms that the magnifier is enabled and configured according to the 306 // Confirms that the magnifier is enabled and configured according to the
308 // explicitly set prefs just after session start. 307 // explicitly set prefs just after session start.
309 EXPECT_TRUE(IsMagnifierEnabled()); 308 EXPECT_TRUE(IsMagnifierEnabled());
310 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 309 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
311 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 310 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
312 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 311 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
313 } 312 }
314 313
315 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { 314 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) {
316 // Creates a new profile once, to run the test with non-new profile. 315 // Creates a new profile once, to run the test with non-new profile.
317 PrepareNonNewProfile(test_account_id_); 316 PrepareNonNewProfile(test_account_id_);
318 } 317 }
319 318
320 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { 319 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) {
321 // Enables full screen magnifier. 320 // Enables full screen magnifier.
322 SetMagnifierType(ash::MAGNIFIER_FULL); 321 SetMagnifierType(ash::MAGNIFIER_FULL);
323 SetMagnifierEnabled(true); 322 SetMagnifierEnabled(true);
324 EXPECT_TRUE(IsMagnifierEnabled()); 323 EXPECT_TRUE(IsMagnifierEnabled());
325 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 324 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
326 325
327 // Logs in (but the session is not started yet). 326 // Logs in (but the session is not started yet).
328 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 327 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
329 kTestUserName, true); 328 kTestUserName);
330 329
331 // Confirms that magnifier is keeping enabled. 330 // Confirms that magnifier is keeping enabled.
332 EXPECT_TRUE(IsMagnifierEnabled()); 331 EXPECT_TRUE(IsMagnifierEnabled());
333 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 332 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
334 333
335 session_manager::SessionManager::Get()->SessionStarted(); 334 session_manager::SessionManager::Get()->SessionStarted();
336 335
337 // Confirms that magnifier is disabled. 336 // Confirms that magnifier is disabled.
338 EXPECT_FALSE(IsMagnifierEnabled()); 337 EXPECT_FALSE(IsMagnifierEnabled());
339 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 338 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
340 } 339 }
341 340
342 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { 341 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) {
343 // Confirms that magnifier is disabled on the login screen. 342 // Confirms that magnifier is disabled on the login screen.
344 EXPECT_FALSE(IsMagnifierEnabled()); 343 EXPECT_FALSE(IsMagnifierEnabled());
345 344
346 // Disables magnifier on login screen explicitly. 345 // Disables magnifier on login screen explicitly.
347 SetMagnifierEnabled(false); 346 SetMagnifierEnabled(false);
348 347
349 // Logs in (but the session is not started yet). 348 // Logs in (but the session is not started yet).
350 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 349 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
351 kTestUserName, true); 350 kTestUserName);
352 351
353 // Confirms that magnifier is keeping disabled. 352 // Confirms that magnifier is keeping disabled.
354 EXPECT_FALSE(IsMagnifierEnabled()); 353 EXPECT_FALSE(IsMagnifierEnabled());
355 354
356 session_manager::SessionManager::Get()->SessionStarted(); 355 session_manager::SessionManager::Get()->SessionStarted();
357 356
358 // Confirms that magnifier is keeping disabled. 357 // Confirms that magnifier is keeping disabled.
359 EXPECT_FALSE(IsMagnifierEnabled()); 358 EXPECT_FALSE(IsMagnifierEnabled());
360 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 359 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
361 } 360 }
362 361
363 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { 362 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) {
364 // Enables magnifier on login screen. 363 // Enables magnifier on login screen.
365 SetMagnifierType(ash::MAGNIFIER_FULL); 364 SetMagnifierType(ash::MAGNIFIER_FULL);
366 SetMagnifierEnabled(true); 365 SetMagnifierEnabled(true);
367 SetFullScreenMagnifierScale(2.5); 366 SetFullScreenMagnifierScale(2.5);
368 EXPECT_TRUE(IsMagnifierEnabled()); 367 EXPECT_TRUE(IsMagnifierEnabled());
369 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 368 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
370 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 369 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
371 370
372 // Logs in (but the session is not started yet). 371 // Logs in (but the session is not started yet).
373 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 372 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
374 kTestUserName, true); 373 kTestUserName);
375 374
376 // Confirms that magnifier is keeping enabled. 375 // Confirms that magnifier is keeping enabled.
377 EXPECT_TRUE(IsMagnifierEnabled()); 376 EXPECT_TRUE(IsMagnifierEnabled());
378 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 377 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
379 378
380 session_manager::SessionManager::Get()->SessionStarted(); 379 session_manager::SessionManager::Get()->SessionStarted();
381 380
382 // Confirms that magnifier keeps enabled. 381 // Confirms that magnifier keeps enabled.
383 EXPECT_TRUE(IsMagnifierEnabled()); 382 EXPECT_TRUE(IsMagnifierEnabled());
384 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 383 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
385 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); 384 EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
386 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); 385 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
387 } 386 }
388 387
389 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { 388 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) {
390 // Confirms that magnifier is disabled on the login screen. 389 // Confirms that magnifier is disabled on the login screen.
391 EXPECT_FALSE(IsMagnifierEnabled()); 390 EXPECT_FALSE(IsMagnifierEnabled());
392 391
393 // Logs in (but the session is not started yet). 392 // Logs in (but the session is not started yet).
394 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 393 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
395 kTestUserName, true); 394 kTestUserName);
396 395
397 // Confirms that magnifier is keeping disabled. 396 // Confirms that magnifier is keeping disabled.
398 EXPECT_FALSE(IsMagnifierEnabled()); 397 EXPECT_FALSE(IsMagnifierEnabled());
399 398
400 session_manager::SessionManager::Get()->SessionStarted(); 399 session_manager::SessionManager::Get()->SessionStarted();
401 400
402 // Confirms that magnifier is keeping disabled. 401 // Confirms that magnifier is keeping disabled.
403 EXPECT_FALSE(IsMagnifierEnabled()); 402 EXPECT_FALSE(IsMagnifierEnabled());
404 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); 403 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
405 } 404 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 EXPECT_FALSE(IsMagnifierEnabled()); 455 EXPECT_FALSE(IsMagnifierEnabled());
457 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 456 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
458 457
459 SetMagnifierType(ash::MAGNIFIER_FULL); 458 SetMagnifierType(ash::MAGNIFIER_FULL);
460 EXPECT_FALSE(IsMagnifierEnabled()); 459 EXPECT_FALSE(IsMagnifierEnabled());
461 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType()); 460 EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
462 } 461 }
463 462
464 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { 463 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
465 // Logs in 464 // Logs in
466 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, 465 session_manager::SessionManager::Get()->CreateSession(test_account_id_,
467 kTestUserName, true); 466 kTestUserName);
468 session_manager::SessionManager::Get()->SessionStarted(); 467 session_manager::SessionManager::Get()->SessionStarted();
469 468
470 // Confirms that magnifier is disabled just after login. 469 // Confirms that magnifier is disabled just after login.
471 EXPECT_FALSE(IsMagnifierEnabled()); 470 EXPECT_FALSE(IsMagnifierEnabled());
472 471
473 // Sets the pref as true to enable magnifier. 472 // Sets the pref as true to enable magnifier.
474 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL); 473 SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL);
475 SetScreenMagnifierEnabledPref(true); 474 SetScreenMagnifierEnabledPref(true);
476 // Confirms that magnifier is enabled. 475 // Confirms that magnifier is enabled.
477 EXPECT_TRUE(IsMagnifierEnabled()); 476 EXPECT_TRUE(IsMagnifierEnabled());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 observer.reset(); 547 observer.reset();
549 548
550 // Set full screen magnifier again, and confirm the observer is not called. 549 // Set full screen magnifier again, and confirm the observer is not called.
551 SetMagnifierType(ash::MAGNIFIER_FULL); 550 SetMagnifierType(ash::MAGNIFIER_FULL);
552 EXPECT_FALSE(observer.observed()); 551 EXPECT_FALSE(observer.observed());
553 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); 552 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
554 observer.reset(); 553 observer.reset();
555 } 554 }
556 555
557 } // namespace chromeos 556 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698