| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 #include "testing/gtest/include/gtest/gtest.h" | 150 #include "testing/gtest/include/gtest/gtest.h" |
| 151 #include "third_party/WebKit/public/web/WebInputEvent.h" | 151 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 152 #include "ui/base/l10n/l10n_util.h" | 152 #include "ui/base/l10n/l10n_util.h" |
| 153 #include "ui/base/page_transition_types.h" | 153 #include "ui/base/page_transition_types.h" |
| 154 #include "ui/base/resource/resource_bundle.h" | 154 #include "ui/base/resource/resource_bundle.h" |
| 155 #include "url/gurl.h" | 155 #include "url/gurl.h" |
| 156 | 156 |
| 157 #if defined(OS_CHROMEOS) | 157 #if defined(OS_CHROMEOS) |
| 158 #include "ash/accelerators/accelerator_controller.h" | 158 #include "ash/accelerators/accelerator_controller.h" |
| 159 #include "ash/accelerators/accelerator_table.h" | 159 #include "ash/accelerators/accelerator_table.h" |
| 160 #include "ash/magnifier/magnifier_constants.h" | |
| 161 #include "ash/shell.h" | 160 #include "ash/shell.h" |
| 162 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 161 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 163 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 162 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 164 #include "chrome/browser/profiles/profile_manager.h" | 163 #include "chrome/browser/profiles/profile_manager.h" |
| 165 #include "chrome/browser/ui/ash/screenshot_taker.h" | 164 #include "chrome/browser/ui/ash/screenshot_taker.h" |
| 166 #include "chromeos/audio/cras_audio_handler.h" | 165 #include "chromeos/audio/cras_audio_handler.h" |
| 166 #include "ui/chromeos/accessibility_types.h" |
| 167 #include "ui/keyboard/keyboard_util.h" | 167 #include "ui/keyboard/keyboard_util.h" |
| 168 #endif | 168 #endif |
| 169 | 169 |
| 170 #if !defined(OS_MACOSX) | 170 #if !defined(OS_MACOSX) |
| 171 #include "base/basictypes.h" | 171 #include "base/basictypes.h" |
| 172 #include "base/compiler_specific.h" | 172 #include "base/compiler_specific.h" |
| 173 #include "chrome/browser/ui/extensions/application_launch.h" | 173 #include "chrome/browser/ui/extensions/application_launch.h" |
| 174 #include "extensions/browser/app_window/app_window.h" | 174 #include "extensions/browser/app_window/app_window.h" |
| 175 #include "extensions/browser/app_window/app_window_registry.h" | 175 #include "extensions/browser/app_window/app_window_registry.h" |
| 176 #include "extensions/browser/app_window/native_app_window.h" | 176 #include "extensions/browser/app_window/native_app_window.h" |
| (...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2681 } | 2681 } |
| 2682 | 2682 |
| 2683 IN_PROC_BROWSER_TEST_F(PolicyTest, SpokenFeedbackEnabled) { | 2683 IN_PROC_BROWSER_TEST_F(PolicyTest, SpokenFeedbackEnabled) { |
| 2684 // Verifies that the spoken feedback accessibility feature can be controlled | 2684 // Verifies that the spoken feedback accessibility feature can be controlled |
| 2685 // through policy. | 2685 // through policy. |
| 2686 chromeos::AccessibilityManager* accessibility_manager = | 2686 chromeos::AccessibilityManager* accessibility_manager = |
| 2687 chromeos::AccessibilityManager::Get(); | 2687 chromeos::AccessibilityManager::Get(); |
| 2688 | 2688 |
| 2689 // Manually enable spoken feedback. | 2689 // Manually enable spoken feedback. |
| 2690 accessibility_manager->EnableSpokenFeedback( | 2690 accessibility_manager->EnableSpokenFeedback( |
| 2691 true, ash::A11Y_NOTIFICATION_NONE); | 2691 true, ui::A11Y_NOTIFICATION_NONE); |
| 2692 EXPECT_TRUE(accessibility_manager->IsSpokenFeedbackEnabled()); | 2692 EXPECT_TRUE(accessibility_manager->IsSpokenFeedbackEnabled()); |
| 2693 | 2693 |
| 2694 // Verify that policy overrides the manual setting. | 2694 // Verify that policy overrides the manual setting. |
| 2695 PolicyMap policies; | 2695 PolicyMap policies; |
| 2696 policies.Set(key::kSpokenFeedbackEnabled, | 2696 policies.Set(key::kSpokenFeedbackEnabled, |
| 2697 POLICY_LEVEL_MANDATORY, | 2697 POLICY_LEVEL_MANDATORY, |
| 2698 POLICY_SCOPE_USER, | 2698 POLICY_SCOPE_USER, |
| 2699 new base::FundamentalValue(false), | 2699 new base::FundamentalValue(false), |
| 2700 NULL); | 2700 NULL); |
| 2701 UpdateProviderPolicy(policies); | 2701 UpdateProviderPolicy(policies); |
| 2702 EXPECT_FALSE(accessibility_manager->IsSpokenFeedbackEnabled()); | 2702 EXPECT_FALSE(accessibility_manager->IsSpokenFeedbackEnabled()); |
| 2703 | 2703 |
| 2704 // Verify that spoken feedback cannot be enabled manually anymore. | 2704 // Verify that spoken feedback cannot be enabled manually anymore. |
| 2705 accessibility_manager->EnableSpokenFeedback( | 2705 accessibility_manager->EnableSpokenFeedback( |
| 2706 true, ash::A11Y_NOTIFICATION_NONE); | 2706 true, ui::A11Y_NOTIFICATION_NONE); |
| 2707 EXPECT_FALSE(accessibility_manager->IsSpokenFeedbackEnabled()); | 2707 EXPECT_FALSE(accessibility_manager->IsSpokenFeedbackEnabled()); |
| 2708 } | 2708 } |
| 2709 | 2709 |
| 2710 IN_PROC_BROWSER_TEST_F(PolicyTest, HighContrastEnabled) { | 2710 IN_PROC_BROWSER_TEST_F(PolicyTest, HighContrastEnabled) { |
| 2711 // Verifies that the high contrast mode accessibility feature can be | 2711 // Verifies that the high contrast mode accessibility feature can be |
| 2712 // controlled through policy. | 2712 // controlled through policy. |
| 2713 chromeos::AccessibilityManager* accessibility_manager = | 2713 chromeos::AccessibilityManager* accessibility_manager = |
| 2714 chromeos::AccessibilityManager::Get(); | 2714 chromeos::AccessibilityManager::Get(); |
| 2715 | 2715 |
| 2716 // Manually enable high contrast mode. | 2716 // Manually enable high contrast mode. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2731 accessibility_manager->EnableHighContrast(true); | 2731 accessibility_manager->EnableHighContrast(true); |
| 2732 EXPECT_FALSE(accessibility_manager->IsHighContrastEnabled()); | 2732 EXPECT_FALSE(accessibility_manager->IsHighContrastEnabled()); |
| 2733 } | 2733 } |
| 2734 | 2734 |
| 2735 IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeNone) { | 2735 IN_PROC_BROWSER_TEST_F(PolicyTest, ScreenMagnifierTypeNone) { |
| 2736 // Verifies that the screen magnifier can be disabled through policy. | 2736 // Verifies that the screen magnifier can be disabled through policy. |
| 2737 chromeos::MagnificationManager* magnification_manager = | 2737 chromeos::MagnificationManager* magnification_manager = |
| 2738 chromeos::MagnificationManager::Get(); | 2738 chromeos::MagnificationManager::Get(); |
| 2739 | 2739 |
| 2740 // Manually enable the full-screen magnifier. | 2740 // Manually enable the full-screen magnifier. |
| 2741 magnification_manager->SetMagnifierType(ash::MAGNIFIER_FULL); | 2741 magnification_manager->SetMagnifierType(ui::MAGNIFIER_FULL); |
| 2742 magnification_manager->SetMagnifierEnabled(true); | 2742 magnification_manager->SetMagnifierEnabled(true); |
| 2743 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); | 2743 EXPECT_EQ(ui::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); |
| 2744 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 2744 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 2745 | 2745 |
| 2746 // Verify that policy overrides the manual setting. | 2746 // Verify that policy overrides the manual setting. |
| 2747 PolicyMap policies; | 2747 PolicyMap policies; |
| 2748 policies.Set(key::kScreenMagnifierType, | 2748 policies.Set(key::kScreenMagnifierType, |
| 2749 POLICY_LEVEL_MANDATORY, | 2749 POLICY_LEVEL_MANDATORY, |
| 2750 POLICY_SCOPE_USER, | 2750 POLICY_SCOPE_USER, |
| 2751 new base::FundamentalValue(0), | 2751 new base::FundamentalValue(0), |
| 2752 NULL); | 2752 NULL); |
| 2753 UpdateProviderPolicy(policies); | 2753 UpdateProviderPolicy(policies); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2764 chromeos::MagnificationManager::Get(); | 2764 chromeos::MagnificationManager::Get(); |
| 2765 | 2765 |
| 2766 // Verify that the screen magnifier is initially disabled. | 2766 // Verify that the screen magnifier is initially disabled. |
| 2767 EXPECT_FALSE(magnification_manager->IsMagnifierEnabled()); | 2767 EXPECT_FALSE(magnification_manager->IsMagnifierEnabled()); |
| 2768 | 2768 |
| 2769 // Verify that policy can enable the full-screen magnifier. | 2769 // Verify that policy can enable the full-screen magnifier. |
| 2770 PolicyMap policies; | 2770 PolicyMap policies; |
| 2771 policies.Set(key::kScreenMagnifierType, | 2771 policies.Set(key::kScreenMagnifierType, |
| 2772 POLICY_LEVEL_MANDATORY, | 2772 POLICY_LEVEL_MANDATORY, |
| 2773 POLICY_SCOPE_USER, | 2773 POLICY_SCOPE_USER, |
| 2774 new base::FundamentalValue(ash::MAGNIFIER_FULL), | 2774 new base::FundamentalValue(ui::MAGNIFIER_FULL), |
| 2775 NULL); | 2775 NULL); |
| 2776 UpdateProviderPolicy(policies); | 2776 UpdateProviderPolicy(policies); |
| 2777 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); | 2777 EXPECT_EQ(ui::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); |
| 2778 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 2778 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 2779 | 2779 |
| 2780 // Verify that the screen magnifier cannot be disabled manually anymore. | 2780 // Verify that the screen magnifier cannot be disabled manually anymore. |
| 2781 magnification_manager->SetMagnifierEnabled(false); | 2781 magnification_manager->SetMagnifierEnabled(false); |
| 2782 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 2782 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 2783 } | 2783 } |
| 2784 | 2784 |
| 2785 IN_PROC_BROWSER_TEST_F(PolicyTest, AccessibilityVirtualKeyboardEnabled) { | 2785 IN_PROC_BROWSER_TEST_F(PolicyTest, AccessibilityVirtualKeyboardEnabled) { |
| 2786 // Verifies that the on-screen keyboard accessibility feature can be | 2786 // Verifies that the on-screen keyboard accessibility feature can be |
| 2787 // controlled through policy. | 2787 // controlled through policy. |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 3426 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 3427 browser2->tab_strip_model()->GetActiveWebContents(), | 3427 browser2->tab_strip_model()->GetActiveWebContents(), |
| 3428 "domAutomationController.send(window.showModalDialog !== undefined);", | 3428 "domAutomationController.send(window.showModalDialog !== undefined);", |
| 3429 &result)); | 3429 &result)); |
| 3430 EXPECT_TRUE(result); | 3430 EXPECT_TRUE(result); |
| 3431 } | 3431 } |
| 3432 | 3432 |
| 3433 #endif // !defined(CHROME_OS) | 3433 #endif // !defined(CHROME_OS) |
| 3434 | 3434 |
| 3435 } // namespace policy | 3435 } // namespace policy |
| OLD | NEW |