| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
| 145 #include "ash/accelerators/accelerator_controller.h" | 145 #include "ash/accelerators/accelerator_controller.h" |
| 146 #include "ash/accelerators/accelerator_table.h" | 146 #include "ash/accelerators/accelerator_table.h" |
| 147 #include "ash/magnifier/magnifier_constants.h" | 147 #include "ash/magnifier/magnifier_constants.h" |
| 148 #include "ash/shell.h" | 148 #include "ash/shell.h" |
| 149 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 149 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 150 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 150 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 151 #include "chrome/browser/profiles/profile_manager.h" | 151 #include "chrome/browser/profiles/profile_manager.h" |
| 152 #include "chrome/browser/ui/ash/screenshot_taker.h" | 152 #include "chrome/browser/ui/ash/screenshot_taker.h" |
| 153 #include "chromeos/audio/cras_audio_handler.h" | 153 #include "chromeos/audio/cras_audio_handler.h" |
| 154 #include "ui/keyboard/keyboard_util.h" |
| 154 #endif | 155 #endif |
| 155 | 156 |
| 156 #if !defined(OS_MACOSX) | 157 #if !defined(OS_MACOSX) |
| 157 #include "apps/app_window.h" | 158 #include "apps/app_window.h" |
| 158 #include "apps/app_window_registry.h" | 159 #include "apps/app_window_registry.h" |
| 159 #include "apps/ui/native_app_window.h" | 160 #include "apps/ui/native_app_window.h" |
| 160 #include "base/basictypes.h" | 161 #include "base/basictypes.h" |
| 161 #include "base/compiler_specific.h" | 162 #include "base/compiler_specific.h" |
| 162 #include "chrome/browser/ui/extensions/application_launch.h" | 163 #include "chrome/browser/ui/extensions/application_launch.h" |
| 163 #include "ui/base/window_open_disposition.h" | 164 #include "ui/base/window_open_disposition.h" |
| (...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 base::Value::CreateIntegerValue(ash::MAGNIFIER_FULL), NULL); | 2408 base::Value::CreateIntegerValue(ash::MAGNIFIER_FULL), NULL); |
| 2408 UpdateProviderPolicy(policies); | 2409 UpdateProviderPolicy(policies); |
| 2409 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); | 2410 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); |
| 2410 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 2411 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 2411 | 2412 |
| 2412 // Verify that the screen magnifier cannot be disabled manually anymore. | 2413 // Verify that the screen magnifier cannot be disabled manually anymore. |
| 2413 magnification_manager->SetMagnifierEnabled(false); | 2414 magnification_manager->SetMagnifierEnabled(false); |
| 2414 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); | 2415 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); |
| 2415 } | 2416 } |
| 2416 | 2417 |
| 2417 IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) { | 2418 IN_PROC_BROWSER_TEST_F(PolicyTest, AccessibilityVirtualKeyboardEnabled) { |
| 2418 // Verifies that the on-screen keyboard accessibility feature can be | 2419 // Verifies that the on-screen keyboard accessibility feature can be |
| 2419 // controlled through policy. | 2420 // controlled through policy. |
| 2420 chromeos::AccessibilityManager* accessibility_manager = | 2421 chromeos::AccessibilityManager* accessibility_manager = |
| 2421 chromeos::AccessibilityManager::Get(); | 2422 chromeos::AccessibilityManager::Get(); |
| 2422 | 2423 |
| 2423 // Manually enable the on-screen keyboard. | 2424 // Manually enable the on-screen keyboard. |
| 2424 accessibility_manager->EnableVirtualKeyboard(true); | 2425 accessibility_manager->EnableVirtualKeyboard(true); |
| 2425 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled()); | 2426 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled()); |
| 2426 | 2427 |
| 2427 // Verify that policy overrides the manual setting. | 2428 // Verify that policy overrides the manual setting. |
| 2428 PolicyMap policies; | 2429 PolicyMap policies; |
| 2429 policies.Set(key::kVirtualKeyboardEnabled, POLICY_LEVEL_MANDATORY, | 2430 policies.Set(key::kVirtualKeyboardEnabled, POLICY_LEVEL_MANDATORY, |
| 2430 POLICY_SCOPE_USER, | 2431 POLICY_SCOPE_USER, |
| 2431 base::Value::CreateBooleanValue(false), NULL); | 2432 base::Value::CreateBooleanValue(false), NULL); |
| 2432 UpdateProviderPolicy(policies); | 2433 UpdateProviderPolicy(policies); |
| 2433 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); | 2434 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); |
| 2434 | 2435 |
| 2435 // Verify that the on-screen keyboard cannot be enabled manually anymore. | 2436 // Verify that the on-screen keyboard cannot be enabled manually anymore. |
| 2436 accessibility_manager->EnableVirtualKeyboard(true); | 2437 accessibility_manager->EnableVirtualKeyboard(true); |
| 2437 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); | 2438 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); |
| 2438 } | 2439 } |
| 2439 | 2440 |
| 2441 IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) { |
| 2442 // Verify keyboard disabled by default. |
| 2443 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
| 2444 // Verify keyboard can be toggled by default. |
| 2445 keyboard::SetTouchKeyboardEnabled(true); |
| 2446 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); |
| 2447 keyboard::SetTouchKeyboardEnabled(false); |
| 2448 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
| 2449 |
| 2450 // Verify policy can enable the keyboard. |
| 2451 PolicyMap policies; |
| 2452 policies.Set(key::kTouchVirtualKeyboardEnabled, |
| 2453 POLICY_LEVEL_MANDATORY, |
| 2454 POLICY_SCOPE_USER, |
| 2455 base::Value::CreateBooleanValue(true), |
| 2456 NULL); |
| 2457 UpdateProviderPolicy(policies); |
| 2458 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); |
| 2459 |
| 2460 // Verify that user cannot set keyboard enabled when policy disables it. |
| 2461 policies.Set(key::kTouchVirtualKeyboardEnabled, |
| 2462 POLICY_LEVEL_MANDATORY, |
| 2463 POLICY_SCOPE_USER, |
| 2464 base::Value::CreateBooleanValue(false), |
| 2465 NULL); |
| 2466 UpdateProviderPolicy(policies); |
| 2467 keyboard::SetTouchKeyboardEnabled(true); |
| 2468 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
| 2469 } |
| 2470 |
| 2440 #endif | 2471 #endif |
| 2441 | 2472 |
| 2442 namespace { | 2473 namespace { |
| 2443 | 2474 |
| 2444 static const char* kRestoredURLs[] = { | 2475 static const char* kRestoredURLs[] = { |
| 2445 "http://aaa.com/empty.html", | 2476 "http://aaa.com/empty.html", |
| 2446 "http://bbb.com/empty.html", | 2477 "http://bbb.com/empty.html", |
| 2447 }; | 2478 }; |
| 2448 | 2479 |
| 2449 bool IsNonSwitchArgument(const CommandLine::StringType& s) { | 2480 bool IsNonSwitchArgument(const CommandLine::StringType& s) { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 PrefService* prefs = browser()->profile()->GetPrefs(); | 3002 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 2972 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3003 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2973 prefs, "host.name")); | 3004 prefs, "host.name")); |
| 2974 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 3005 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2975 prefs, "other.host.name")); | 3006 prefs, "other.host.name")); |
| 2976 } | 3007 } |
| 2977 | 3008 |
| 2978 #endif // !defined(CHROME_OS) | 3009 #endif // !defined(CHROME_OS) |
| 2979 | 3010 |
| 2980 } // namespace policy | 3011 } // namespace policy |
| OLD | NEW |