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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 command_line->AppendSwitchASCII(switches::kLoginProfile, | 157 command_line->AppendSwitchASCII(switches::kLoginProfile, |
157 TestingProfile::kTestUserProfileDir); | 158 TestingProfile::kTestUserProfileDir); |
158 } | 159 } |
159 | 160 |
160 void SetUpOnMainThread() override { | 161 void SetUpOnMainThread() override { |
161 // Set the login-screen profile. | 162 // Set the login-screen profile. |
162 MagnificationManager::Get()->SetProfileForTest( | 163 MagnificationManager::Get()->SetProfileForTest( |
163 ProfileManager::GetActiveUserProfile()); | 164 ProfileManager::GetActiveUserProfile()); |
164 } | 165 } |
165 | 166 |
| 167 const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUserName); |
| 168 |
166 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); | 169 DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest); |
167 }; | 170 }; |
168 | 171 |
169 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) { | 172 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) { |
170 // Create a new profile once, to run the test with non-new profile. | 173 // Create a new profile once, to run the test with non-new profile. |
171 PrepareNonNewProfile(kTestUserName); | 174 PrepareNonNewProfile(test_account_id_); |
172 | 175 |
173 // Sets pref to explicitly disable the magnifier. | 176 // Sets pref to explicitly disable the magnifier. |
174 SetScreenMagnifierEnabledPref(false); | 177 SetScreenMagnifierEnabledPref(false); |
175 } | 178 } |
176 | 179 |
177 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { | 180 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) { |
178 // Confirms that magnifier is disabled on the login screen. | 181 // Confirms that magnifier is disabled on the login screen. |
179 EXPECT_FALSE(IsMagnifierEnabled()); | 182 EXPECT_FALSE(IsMagnifierEnabled()); |
180 | 183 |
181 // Disables magnifier on login screen. | 184 // Disables magnifier on login screen. |
182 SetMagnifierEnabled(false); | 185 SetMagnifierEnabled(false); |
183 EXPECT_FALSE(IsMagnifierEnabled()); | 186 EXPECT_FALSE(IsMagnifierEnabled()); |
184 | 187 |
185 // Logs in with existing profile. | 188 // Logs in with existing profile. |
186 user_manager::UserManager::Get()->UserLoggedIn( | 189 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
187 kTestUserName, kTestUserName, true); | 190 kTestUserName, true); |
188 | 191 |
189 // Confirms that magnifier is still disabled just after login. | 192 // Confirms that magnifier is still disabled just after login. |
190 EXPECT_FALSE(IsMagnifierEnabled()); | 193 EXPECT_FALSE(IsMagnifierEnabled()); |
191 | 194 |
192 user_manager::UserManager::Get()->SessionStarted(); | 195 user_manager::UserManager::Get()->SessionStarted(); |
193 | 196 |
194 // Confirms that magnifier is still disabled just after session starts. | 197 // Confirms that magnifier is still disabled just after session starts. |
195 EXPECT_FALSE(IsMagnifierEnabled()); | 198 EXPECT_FALSE(IsMagnifierEnabled()); |
196 | 199 |
197 // Enables magnifier. | 200 // Enables magnifier. |
198 SetMagnifierEnabled(true); | 201 SetMagnifierEnabled(true); |
199 // Confirms that magnifier is enabled. | 202 // Confirms that magnifier is enabled. |
200 EXPECT_TRUE(IsMagnifierEnabled()); | 203 EXPECT_TRUE(IsMagnifierEnabled()); |
201 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 204 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
202 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 205 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
203 } | 206 } |
204 | 207 |
205 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { | 208 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) { |
206 // Create a new profile once, to run the test with non-new profile. | 209 // Create a new profile once, to run the test with non-new profile. |
207 PrepareNonNewProfile(kTestUserName); | 210 PrepareNonNewProfile(test_account_id_); |
208 | 211 |
209 // Sets pref to explicitly disable the magnifier. | 212 // Sets pref to explicitly disable the magnifier. |
210 SetScreenMagnifierEnabledPref(false); | 213 SetScreenMagnifierEnabledPref(false); |
211 } | 214 } |
212 | 215 |
213 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { | 216 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) { |
214 // Confirms that magnifier is disabled on the login screen. | 217 // Confirms that magnifier is disabled on the login screen. |
215 EXPECT_FALSE(IsMagnifierEnabled()); | 218 EXPECT_FALSE(IsMagnifierEnabled()); |
216 | 219 |
217 // Enables magnifier on login screen. | 220 // Enables magnifier on login screen. |
218 SetMagnifierEnabled(true); | 221 SetMagnifierEnabled(true); |
219 SetMagnifierType(ui::MAGNIFIER_FULL); | 222 SetMagnifierType(ui::MAGNIFIER_FULL); |
220 SetFullScreenMagnifierScale(2.5); | 223 SetFullScreenMagnifierScale(2.5); |
221 EXPECT_TRUE(IsMagnifierEnabled()); | 224 EXPECT_TRUE(IsMagnifierEnabled()); |
222 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 225 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
223 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 226 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
224 | 227 |
225 // Logs in (but the session is not started yet). | 228 // Logs in (but the session is not started yet). |
226 user_manager::UserManager::Get()->UserLoggedIn( | 229 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
227 kTestUserName, kTestUserName, true); | 230 kTestUserName, true); |
228 | 231 |
229 // Confirms that magnifier is keeping enabled. | 232 // Confirms that magnifier is keeping enabled. |
230 EXPECT_TRUE(IsMagnifierEnabled()); | 233 EXPECT_TRUE(IsMagnifierEnabled()); |
231 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 234 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
232 | 235 |
233 user_manager::UserManager::Get()->SessionStarted(); | 236 user_manager::UserManager::Get()->SessionStarted(); |
234 | 237 |
235 // Confirms that magnifier is disabled just after session start. | 238 // Confirms that magnifier is disabled just after session start. |
236 EXPECT_FALSE(IsMagnifierEnabled()); | 239 EXPECT_FALSE(IsMagnifierEnabled()); |
237 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 240 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
238 } | 241 } |
239 | 242 |
240 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { | 243 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) { |
241 // Create a new profile once, to run the test with non-new profile. | 244 // Create a new profile once, to run the test with non-new profile. |
242 PrepareNonNewProfile(kTestUserName); | 245 PrepareNonNewProfile(test_account_id_); |
243 | 246 |
244 // Sets prefs to explicitly enable the magnifier. | 247 // Sets prefs to explicitly enable the magnifier. |
245 SetScreenMagnifierEnabledPref(true); | 248 SetScreenMagnifierEnabledPref(true); |
246 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 249 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
247 SetFullScreenMagnifierScalePref(2.5); | 250 SetFullScreenMagnifierScalePref(2.5); |
248 } | 251 } |
249 | 252 |
250 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { | 253 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) { |
251 // Disables magnifier on login screen. | 254 // Disables magnifier on login screen. |
252 SetMagnifierEnabled(false); | 255 SetMagnifierEnabled(false); |
253 EXPECT_FALSE(IsMagnifierEnabled()); | 256 EXPECT_FALSE(IsMagnifierEnabled()); |
254 | 257 |
255 // Logs in (but the session is not started yet). | 258 // Logs in (but the session is not started yet). |
256 user_manager::UserManager::Get()->UserLoggedIn( | 259 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
257 kTestUserName, kTestUserName, true); | 260 kTestUserName, true); |
258 | 261 |
259 // Confirms that magnifier is keeping disabled. | 262 // Confirms that magnifier is keeping disabled. |
260 EXPECT_FALSE(IsMagnifierEnabled()); | 263 EXPECT_FALSE(IsMagnifierEnabled()); |
261 | 264 |
262 user_manager::UserManager::Get()->SessionStarted(); | 265 user_manager::UserManager::Get()->SessionStarted(); |
263 | 266 |
264 // Confirms that the magnifier is enabled and configured according to the | 267 // Confirms that the magnifier is enabled and configured according to the |
265 // explicitly set prefs just after session start. | 268 // explicitly set prefs just after session start. |
266 EXPECT_TRUE(IsMagnifierEnabled()); | 269 EXPECT_TRUE(IsMagnifierEnabled()); |
267 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 270 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
268 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 271 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
269 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 272 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
270 } | 273 } |
271 | 274 |
272 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { | 275 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) { |
273 // Create a new profile once, to run the test with non-new profile. | 276 // Create a new profile once, to run the test with non-new profile. |
274 PrepareNonNewProfile(kTestUserName); | 277 PrepareNonNewProfile(test_account_id_); |
275 | 278 |
276 // Sets prefs to explicitly enable the magnifier. | 279 // Sets prefs to explicitly enable the magnifier. |
277 SetScreenMagnifierEnabledPref(true); | 280 SetScreenMagnifierEnabledPref(true); |
278 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 281 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
279 SetFullScreenMagnifierScalePref(2.5); | 282 SetFullScreenMagnifierScalePref(2.5); |
280 } | 283 } |
281 | 284 |
282 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { | 285 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) { |
283 // Enables magnifier on login screen. | 286 // Enables magnifier on login screen. |
284 SetMagnifierType(ui::MAGNIFIER_FULL); | 287 SetMagnifierType(ui::MAGNIFIER_FULL); |
285 SetMagnifierEnabled(true); | 288 SetMagnifierEnabled(true); |
286 SetFullScreenMagnifierScale(3.0); | 289 SetFullScreenMagnifierScale(3.0); |
287 EXPECT_TRUE(IsMagnifierEnabled()); | 290 EXPECT_TRUE(IsMagnifierEnabled()); |
288 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 291 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
289 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); | 292 EXPECT_EQ(3.0, GetFullScreenMagnifierScale()); |
290 | 293 |
291 // Logs in (but the session is not started yet). | 294 // Logs in (but the session is not started yet). |
292 user_manager::UserManager::Get()->UserLoggedIn( | 295 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
293 kTestUserName, kTestUserName, true); | 296 kTestUserName, true); |
294 | 297 |
295 // Confirms that magnifier is keeping enabled. | 298 // Confirms that magnifier is keeping enabled. |
296 EXPECT_TRUE(IsMagnifierEnabled()); | 299 EXPECT_TRUE(IsMagnifierEnabled()); |
297 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 300 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
298 | 301 |
299 user_manager::UserManager::Get()->SessionStarted(); | 302 user_manager::UserManager::Get()->SessionStarted(); |
300 | 303 |
301 // Confirms that the magnifier is enabled and configured according to the | 304 // Confirms that the magnifier is enabled and configured according to the |
302 // explicitly set prefs just after session start. | 305 // explicitly set prefs just after session start. |
303 EXPECT_TRUE(IsMagnifierEnabled()); | 306 EXPECT_TRUE(IsMagnifierEnabled()); |
304 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 307 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
305 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 308 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
306 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 309 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
307 } | 310 } |
308 | 311 |
309 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { | 312 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) { |
310 // Creates a new profile once, to run the test with non-new profile. | 313 // Creates a new profile once, to run the test with non-new profile. |
311 PrepareNonNewProfile(kTestUserName); | 314 PrepareNonNewProfile(test_account_id_); |
312 } | 315 } |
313 | 316 |
314 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { | 317 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) { |
315 // Enables full screen magnifier. | 318 // Enables full screen magnifier. |
316 SetMagnifierType(ui::MAGNIFIER_FULL); | 319 SetMagnifierType(ui::MAGNIFIER_FULL); |
317 SetMagnifierEnabled(true); | 320 SetMagnifierEnabled(true); |
318 EXPECT_TRUE(IsMagnifierEnabled()); | 321 EXPECT_TRUE(IsMagnifierEnabled()); |
319 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 322 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
320 | 323 |
321 // Logs in (but the session is not started yet). | 324 // Logs in (but the session is not started yet). |
322 user_manager::UserManager::Get()->UserLoggedIn( | 325 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
323 kTestUserName, kTestUserName, true); | 326 kTestUserName, true); |
324 | 327 |
325 // Confirms that magnifier is keeping enabled. | 328 // Confirms that magnifier is keeping enabled. |
326 EXPECT_TRUE(IsMagnifierEnabled()); | 329 EXPECT_TRUE(IsMagnifierEnabled()); |
327 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 330 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
328 | 331 |
329 user_manager::UserManager::Get()->SessionStarted(); | 332 user_manager::UserManager::Get()->SessionStarted(); |
330 | 333 |
331 // Confirms that magnifier is disabled. | 334 // Confirms that magnifier is disabled. |
332 EXPECT_FALSE(IsMagnifierEnabled()); | 335 EXPECT_FALSE(IsMagnifierEnabled()); |
333 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 336 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
334 } | 337 } |
335 | 338 |
336 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { | 339 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) { |
337 // Confirms that magnifier is disabled on the login screen. | 340 // Confirms that magnifier is disabled on the login screen. |
338 EXPECT_FALSE(IsMagnifierEnabled()); | 341 EXPECT_FALSE(IsMagnifierEnabled()); |
339 | 342 |
340 // Disables magnifier on login screen explicitly. | 343 // Disables magnifier on login screen explicitly. |
341 SetMagnifierEnabled(false); | 344 SetMagnifierEnabled(false); |
342 | 345 |
343 // Logs in (but the session is not started yet). | 346 // Logs in (but the session is not started yet). |
344 user_manager::UserManager::Get()->UserLoggedIn( | 347 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
345 kTestUserName, kTestUserName, true); | 348 kTestUserName, true); |
346 | 349 |
347 // Confirms that magnifier is keeping disabled. | 350 // Confirms that magnifier is keeping disabled. |
348 EXPECT_FALSE(IsMagnifierEnabled()); | 351 EXPECT_FALSE(IsMagnifierEnabled()); |
349 | 352 |
350 user_manager::UserManager::Get()->SessionStarted(); | 353 user_manager::UserManager::Get()->SessionStarted(); |
351 | 354 |
352 // Confirms that magnifier is keeping disabled. | 355 // Confirms that magnifier is keeping disabled. |
353 EXPECT_FALSE(IsMagnifierEnabled()); | 356 EXPECT_FALSE(IsMagnifierEnabled()); |
354 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 357 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
355 } | 358 } |
356 | 359 |
357 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { | 360 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) { |
358 // Enables magnifier on login screen. | 361 // Enables magnifier on login screen. |
359 SetMagnifierType(ui::MAGNIFIER_FULL); | 362 SetMagnifierType(ui::MAGNIFIER_FULL); |
360 SetMagnifierEnabled(true); | 363 SetMagnifierEnabled(true); |
361 SetFullScreenMagnifierScale(2.5); | 364 SetFullScreenMagnifierScale(2.5); |
362 EXPECT_TRUE(IsMagnifierEnabled()); | 365 EXPECT_TRUE(IsMagnifierEnabled()); |
363 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 366 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
364 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 367 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
365 | 368 |
366 // Logs in (but the session is not started yet). | 369 // Logs in (but the session is not started yet). |
367 user_manager::UserManager::Get()->UserLoggedIn( | 370 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
368 kTestUserName, kTestUserName, true); | 371 kTestUserName, true); |
369 | 372 |
370 // Confirms that magnifier is keeping enabled. | 373 // Confirms that magnifier is keeping enabled. |
371 EXPECT_TRUE(IsMagnifierEnabled()); | 374 EXPECT_TRUE(IsMagnifierEnabled()); |
372 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 375 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
373 | 376 |
374 user_manager::UserManager::Get()->SessionStarted(); | 377 user_manager::UserManager::Get()->SessionStarted(); |
375 | 378 |
376 // Confirms that magnifier keeps enabled. | 379 // Confirms that magnifier keeps enabled. |
377 EXPECT_TRUE(IsMagnifierEnabled()); | 380 EXPECT_TRUE(IsMagnifierEnabled()); |
378 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 381 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
379 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); | 382 EXPECT_EQ(2.5, GetFullScreenMagnifierScale()); |
380 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); | 383 EXPECT_TRUE(GetScreenMagnifierEnabledFromPref()); |
381 } | 384 } |
382 | 385 |
383 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { | 386 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) { |
384 // Confirms that magnifier is disabled on the login screen. | 387 // Confirms that magnifier is disabled on the login screen. |
385 EXPECT_FALSE(IsMagnifierEnabled()); | 388 EXPECT_FALSE(IsMagnifierEnabled()); |
386 | 389 |
387 // Logs in (but the session is not started yet). | 390 // Logs in (but the session is not started yet). |
388 user_manager::UserManager::Get()->UserLoggedIn( | 391 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
389 kTestUserName, kTestUserName, true); | 392 kTestUserName, true); |
390 | 393 |
391 // Confirms that magnifier is keeping disabled. | 394 // Confirms that magnifier is keeping disabled. |
392 EXPECT_FALSE(IsMagnifierEnabled()); | 395 EXPECT_FALSE(IsMagnifierEnabled()); |
393 | 396 |
394 user_manager::UserManager::Get()->SessionStarted(); | 397 user_manager::UserManager::Get()->SessionStarted(); |
395 | 398 |
396 // Confirms that magnifier is keeping disabled. | 399 // Confirms that magnifier is keeping disabled. |
397 EXPECT_FALSE(IsMagnifierEnabled()); | 400 EXPECT_FALSE(IsMagnifierEnabled()); |
398 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); | 401 EXPECT_FALSE(GetScreenMagnifierEnabledFromPref()); |
399 } | 402 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 EXPECT_FALSE(IsMagnifierEnabled()); | 453 EXPECT_FALSE(IsMagnifierEnabled()); |
451 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 454 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
452 | 455 |
453 SetMagnifierType(ui::MAGNIFIER_FULL); | 456 SetMagnifierType(ui::MAGNIFIER_FULL); |
454 EXPECT_FALSE(IsMagnifierEnabled()); | 457 EXPECT_FALSE(IsMagnifierEnabled()); |
455 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); | 458 EXPECT_EQ(ui::MAGNIFIER_FULL, GetMagnifierType()); |
456 } | 459 } |
457 | 460 |
458 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { | 461 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) { |
459 // Logs in | 462 // Logs in |
460 user_manager::UserManager::Get()->UserLoggedIn( | 463 user_manager::UserManager::Get()->UserLoggedIn(test_account_id_, |
461 kTestUserName, kTestUserName, true); | 464 kTestUserName, true); |
462 user_manager::UserManager::Get()->SessionStarted(); | 465 user_manager::UserManager::Get()->SessionStarted(); |
463 | 466 |
464 // Confirms that magnifier is disabled just after login. | 467 // Confirms that magnifier is disabled just after login. |
465 EXPECT_FALSE(IsMagnifierEnabled()); | 468 EXPECT_FALSE(IsMagnifierEnabled()); |
466 | 469 |
467 // Sets the pref as true to enable magnifier. | 470 // Sets the pref as true to enable magnifier. |
468 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); | 471 SetScreenMagnifierTypePref(ui::MAGNIFIER_FULL); |
469 SetScreenMagnifierEnabledPref(true); | 472 SetScreenMagnifierEnabledPref(true); |
470 // Confirms that magnifier is enabled. | 473 // Confirms that magnifier is enabled. |
471 EXPECT_TRUE(IsMagnifierEnabled()); | 474 EXPECT_TRUE(IsMagnifierEnabled()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 observer.reset(); | 545 observer.reset(); |
543 | 546 |
544 // Set full screen magnifier again, and confirm the observer is not called. | 547 // Set full screen magnifier again, and confirm the observer is not called. |
545 SetMagnifierType(ui::MAGNIFIER_FULL); | 548 SetMagnifierType(ui::MAGNIFIER_FULL); |
546 EXPECT_FALSE(observer.observed()); | 549 EXPECT_FALSE(observer.observed()); |
547 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); | 550 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); |
548 observer.reset(); | 551 observer.reset(); |
549 } | 552 } |
550 | 553 |
551 } // namespace chromeos | 554 } // namespace chromeos |
OLD | NEW |