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

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

Issue 11415025: A11y: Introduce High Contrast Mode and Screen Magnifier to ubar tray. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase @170134 Created 8 years 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" 7 #include "chrome/browser/chromeos/accessibility/accessibility_util.h"
8 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 8 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 9 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
10 #include "chrome/browser/chromeos/login/helper.h" 10 #include "chrome/browser/chromeos/login/helper.h"
(...skipping 25 matching lines...) Expand all
36 Profile* profile() { 36 Profile* profile() {
37 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); 37 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
38 DCHECK(profile); 38 DCHECK(profile);
39 return profile; 39 return profile;
40 } 40 }
41 41
42 PrefServiceBase* prefs() { 42 PrefServiceBase* prefs() {
43 return PrefServiceBase::FromBrowserContext(profile()); 43 return PrefServiceBase::FromBrowserContext(profile());
44 } 44 }
45 45
46 void SetScreenManagnifierTypeToPref(accessibility::ScreenMagnifierType type) { 46 void SetScreenManagnifierTypeToPref(ash::MagnifierType type) {
47 prefs()->SetString(prefs::kScreenMagnifierType, 47 prefs()->SetString(prefs::kMagnifierType,
48 ScreenMagnifierNameFromType(type)); 48 accessibility::ScreenMagnifierNameFromType(type));
49 } 49 }
50 50
51 void CheckCurrentScreenMagnifierType( 51 void CheckCurrentMagnifierType(
52 accessibility::ScreenMagnifierType type) { 52 ash::MagnifierType type) {
53 EXPECT_EQ(MagnificationManager::GetInstance()->GetScreenMagnifierType(), 53 EXPECT_EQ(MagnificationManager::GetInstance()->GetMagnifierType(),
54 type); 54 type);
55 } 55 }
56 56
57 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); 57 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest);
58 }; 58 };
59 59
60 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, Login) { 60 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, Login) {
61 // Confirms that magnifier is enabled on the login screen. 61 // Confirms that magnifier is enabled on the login screen.
62 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL); 62 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
63 63
64 // Logs in. 64 // Logs in.
65 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); 65 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
66 UserManager::Get()->SessionStarted(); 66 UserManager::Get()->SessionStarted();
67 67
68 // Confirms that magnifier is disabled just after login. 68 // Confirms that magnifier is disabled just after login.
69 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF); 69 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
70 70
71 // Enables magnifier. 71 // Enables magnifier.
72 SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL); 72 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
73 73
74 // Confirms that magnifier is enabled. 74 // Confirms that magnifier is enabled.
75 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL); 75 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
76 } 76 }
77 77
78 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, WorkingWithPref) { 78 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, WorkingWithPref) {
79 // Logs in 79 // Logs in
80 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); 80 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
81 UserManager::Get()->SessionStarted(); 81 UserManager::Get()->SessionStarted();
82 82
83 // Confirms that magnifier is disabled just after login. 83 // Confirms that magnifier is disabled just after login.
84 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF); 84 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
85 85
86 // Sets the pref as true to enable magnifier. 86 // Sets the pref as true to enable magnifier.
87 SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL); 87 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
88 88
89 // Confirms that magnifier is enabled. 89 // Confirms that magnifier is enabled.
90 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL); 90 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
91 91
92 // Sets the pref as false to disabled magnifier. 92 // Sets the pref as false to disabled magnifier.
93 SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_OFF); 93 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
94 94
95 // Confirms that magnifier is disabled. 95 // Confirms that magnifier is disabled.
96 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_OFF); 96 CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
97 97
98 // Sets the pref as true to enable magnifier again. 98 // Sets the pref as true to enable magnifier again.
99 SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL); 99 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
100 100
101 // Confirms that magnifier is enabled. 101 // Confirms that magnifier is enabled.
102 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL); 102 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
103 } 103 }
104 104
105 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedPref) { 105 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedPref) {
106 // Loads the profile of the user. 106 // Loads the profile of the user.
107 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true); 107 UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
108 108
109 // Sets the pref as true to enable magnifier before login. 109 // Sets the pref as true to enable magnifier before login.
110 SetScreenManagnifierTypeToPref(accessibility::MAGNIFIER_FULL); 110 SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
111 111
112 // Logs in. 112 // Logs in.
113 UserManager::Get()->SessionStarted(); 113 UserManager::Get()->SessionStarted();
114 114
115 // Confirms that magnifier is enabled just after login. 115 // Confirms that magnifier is enabled just after login.
116 CheckCurrentScreenMagnifierType(accessibility::MAGNIFIER_FULL); 116 CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
117 } 117 }
118 118
119 } // namespace chromeos 119 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/magnification_manager.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698