| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/magnifier_constants.h" | |
| 8 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 8 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 13 #include "base/location.h" | 12 #include "base/location.h" |
| 14 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 15 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
| 16 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 17 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 18 #include "base/values.h" | 17 #include "base/values.h" |
| 19 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 18 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 20 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 19 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 21 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 20 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 22 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" | 21 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" |
| 23 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 22 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 24 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 25 #include "chrome/browser/lifetime/application_lifetime.h" | 24 #include "chrome/browser/lifetime/application_lifetime.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 28 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 29 #include "chromeos/chromeos_switches.h" | 28 #include "chromeos/chromeos_switches.h" |
| 30 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 #include "ui/chromeos/accessibility_types.h" |
| 31 | 31 |
| 32 namespace em = enterprise_management; | 32 namespace em = enterprise_management; |
| 33 | 33 |
| 34 namespace policy { | 34 namespace policy { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 const em::AccessibilitySettingsProto_ScreenMagnifierType kFullScreenMagnifier = | 38 const em::AccessibilitySettingsProto_ScreenMagnifierType kFullScreenMagnifier = |
| 39 em::AccessibilitySettingsProto_ScreenMagnifierType_SCREEN_MAGNIFIER_TYPE_FUL
L; | 39 em::AccessibilitySettingsProto_ScreenMagnifierType_SCREEN_MAGNIFIER_TYPE_FUL
L; |
| 40 | 40 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 proto.mutable_accessibility_settings()-> | 319 proto.mutable_accessibility_settings()-> |
| 320 set_login_screen_default_screen_magnifier_type(kFullScreenMagnifier); | 320 set_login_screen_default_screen_magnifier_type(kFullScreenMagnifier); |
| 321 RefreshDevicePolicyAndWaitForPrefChange( | 321 RefreshDevicePolicyAndWaitForPrefChange( |
| 322 prefs::kAccessibilityScreenMagnifierType); | 322 prefs::kAccessibilityScreenMagnifierType); |
| 323 | 323 |
| 324 // Verify that the prefs which control the screen magnifier type have changed | 324 // Verify that the prefs which control the screen magnifier type have changed |
| 325 // to the policy-supplied default. | 325 // to the policy-supplied default. |
| 326 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled, | 326 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled, |
| 327 base::FundamentalValue(true)); | 327 base::FundamentalValue(true)); |
| 328 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType, | 328 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType, |
| 329 base::FundamentalValue(ash::MAGNIFIER_FULL)); | 329 base::FundamentalValue(ui::MAGNIFIER_FULL)); |
| 330 | 330 |
| 331 // Verify that the full-screen magnifier is enabled. | 331 // Verify that the full-screen magnifier is enabled. |
| 332 chromeos::MagnificationManager* magnification_manager = | 332 chromeos::MagnificationManager* magnification_manager = |
| 333 chromeos::MagnificationManager::Get(); | 333 chromeos::MagnificationManager::Get(); |
| 334 ASSERT_TRUE(magnification_manager); | 334 ASSERT_TRUE(magnification_manager); |
| 335 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 335 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 336 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); | 336 EXPECT_EQ(ui::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); |
| 337 } | 337 } |
| 338 | 338 |
| 339 IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyInSessionBrowsertest, | 339 IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyInSessionBrowsertest, |
| 340 DeviceLoginScreenDefaultLargeCursorEnabled) { | 340 DeviceLoginScreenDefaultLargeCursorEnabled) { |
| 341 // Verifies that changing the default state of the large cursor accessibility | 341 // Verifies that changing the default state of the large cursor accessibility |
| 342 // feature on the login screen through policy does not affect its state in a | 342 // feature on the login screen through policy does not affect its state in a |
| 343 // session. | 343 // session. |
| 344 | 344 |
| 345 // Enable the large cursor through device policy and wait for the change to | 345 // Enable the large cursor through device policy and wait for the change to |
| 346 // take effect. | 346 // take effect. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 // Verify that the prefs which control the screen magnifier in the session are | 427 // Verify that the prefs which control the screen magnifier in the session are |
| 428 // unchanged. | 428 // unchanged. |
| 429 VerifyPrefFollowsDefault(prefs::kAccessibilityScreenMagnifierEnabled); | 429 VerifyPrefFollowsDefault(prefs::kAccessibilityScreenMagnifierEnabled); |
| 430 VerifyPrefFollowsDefault(prefs::kAccessibilityScreenMagnifierType); | 430 VerifyPrefFollowsDefault(prefs::kAccessibilityScreenMagnifierType); |
| 431 | 431 |
| 432 // Verify that the screen magnifier is disabled. | 432 // Verify that the screen magnifier is disabled. |
| 433 chromeos::MagnificationManager* magnification_manager = | 433 chromeos::MagnificationManager* magnification_manager = |
| 434 chromeos::MagnificationManager::Get(); | 434 chromeos::MagnificationManager::Get(); |
| 435 ASSERT_TRUE(magnification_manager); | 435 ASSERT_TRUE(magnification_manager); |
| 436 EXPECT_FALSE(magnification_manager->IsMagnifierEnabled()); | 436 EXPECT_FALSE(magnification_manager->IsMagnifierEnabled()); |
| 437 EXPECT_EQ(ash::kDefaultMagnifierType, | 437 EXPECT_EQ(ui::kDefaultMagnifierType, |
| 438 magnification_manager->GetMagnifierType()); | 438 magnification_manager->GetMagnifierType()); |
| 439 } | 439 } |
| 440 | 440 |
| 441 IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyLoginScreenBrowsertest, | 441 IN_PROC_BROWSER_TEST_F(LoginScreenDefaultPolicyLoginScreenBrowsertest, |
| 442 DeviceLoginScreenDefaultVirtualKeyboardEnabled) { | 442 DeviceLoginScreenDefaultVirtualKeyboardEnabled) { |
| 443 // Verifies that the default state of the on-screen keyboard accessibility | 443 // Verifies that the default state of the on-screen keyboard accessibility |
| 444 // feature on the login screen can be controlled through device policy. | 444 // feature on the login screen can be controlled through device policy. |
| 445 | 445 |
| 446 // Enable the on-screen keyboard through device policy and wait for the change | 446 // Enable the on-screen keyboard through device policy and wait for the change |
| 447 // to take effect. | 447 // to take effect. |
| 448 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); | 448 em::ChromeDeviceSettingsProto& proto(device_policy()->payload()); |
| 449 proto.mutable_accessibility_settings()-> | 449 proto.mutable_accessibility_settings()-> |
| 450 set_login_screen_default_virtual_keyboard_enabled(true); | 450 set_login_screen_default_virtual_keyboard_enabled(true); |
| 451 RefreshDevicePolicyAndWaitForPrefChange( | 451 RefreshDevicePolicyAndWaitForPrefChange( |
| 452 prefs::kAccessibilityVirtualKeyboardEnabled); | 452 prefs::kAccessibilityVirtualKeyboardEnabled); |
| 453 | 453 |
| 454 // Verify that the pref which controls the on-screen keyboard in the login | 454 // Verify that the pref which controls the on-screen keyboard in the login |
| 455 // profile has changed to the policy-supplied default. | 455 // profile has changed to the policy-supplied default. |
| 456 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled, | 456 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled, |
| 457 base::FundamentalValue(true)); | 457 base::FundamentalValue(true)); |
| 458 | 458 |
| 459 // Verify that the on-screen keyboard is enabled. | 459 // Verify that the on-screen keyboard is enabled. |
| 460 chromeos::AccessibilityManager* accessibility_manager = | 460 chromeos::AccessibilityManager* accessibility_manager = |
| 461 chromeos::AccessibilityManager::Get(); | 461 chromeos::AccessibilityManager::Get(); |
| 462 ASSERT_TRUE(accessibility_manager); | 462 ASSERT_TRUE(accessibility_manager); |
| 463 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled()); | 463 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled()); |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace policy | 466 } // namespace policy |
| OLD | NEW |