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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 320223002: Add device policy: Kiosk Virtual Keyboard Layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to master. Created 6 years, 6 months 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 | Annotate | Revision Log
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 <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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 #if defined(OS_CHROMEOS) 145 #if defined(OS_CHROMEOS)
146 #include "ash/accelerators/accelerator_controller.h" 146 #include "ash/accelerators/accelerator_controller.h"
147 #include "ash/accelerators/accelerator_table.h" 147 #include "ash/accelerators/accelerator_table.h"
148 #include "ash/magnifier/magnifier_constants.h" 148 #include "ash/magnifier/magnifier_constants.h"
149 #include "ash/shell.h" 149 #include "ash/shell.h"
150 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 150 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
151 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 151 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
152 #include "chrome/browser/profiles/profile_manager.h" 152 #include "chrome/browser/profiles/profile_manager.h"
153 #include "chrome/browser/ui/ash/screenshot_taker.h" 153 #include "chrome/browser/ui/ash/screenshot_taker.h"
154 #include "chromeos/audio/cras_audio_handler.h" 154 #include "chromeos/audio/cras_audio_handler.h"
155 #include "ui/keyboard/keyboard_util.h"
155 #endif 156 #endif
156 157
157 #if !defined(OS_MACOSX) 158 #if !defined(OS_MACOSX)
158 #include "apps/app_window.h" 159 #include "apps/app_window.h"
159 #include "apps/app_window_registry.h" 160 #include "apps/app_window_registry.h"
160 #include "apps/ui/native_app_window.h" 161 #include "apps/ui/native_app_window.h"
161 #include "base/basictypes.h" 162 #include "base/basictypes.h"
162 #include "base/compiler_specific.h" 163 #include "base/compiler_specific.h"
163 #include "chrome/browser/ui/extensions/application_launch.h" 164 #include "chrome/browser/ui/extensions/application_launch.h"
164 #include "ui/base/window_open_disposition.h" 165 #include "ui/base/window_open_disposition.h"
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 base::Value::CreateIntegerValue(ash::MAGNIFIER_FULL), NULL); 2412 base::Value::CreateIntegerValue(ash::MAGNIFIER_FULL), NULL);
2412 UpdateProviderPolicy(policies); 2413 UpdateProviderPolicy(policies);
2413 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType()); 2414 EXPECT_EQ(ash::MAGNIFIER_FULL, magnification_manager->GetMagnifierType());
2414 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); 2415 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled());
2415 2416
2416 // Verify that the screen magnifier cannot be disabled manually anymore. 2417 // Verify that the screen magnifier cannot be disabled manually anymore.
2417 magnification_manager->SetMagnifierEnabled(false); 2418 magnification_manager->SetMagnifierEnabled(false);
2418 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled()); 2419 EXPECT_TRUE(magnification_manager->IsMagnifierEnabled());
2419 } 2420 }
2420 2421
2421 IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) { 2422 IN_PROC_BROWSER_TEST_F(PolicyTest, AccessibilityVirtualKeyboardEnabled) {
2422 // Verifies that the on-screen keyboard accessibility feature can be 2423 // Verifies that the on-screen keyboard accessibility feature can be
2423 // controlled through policy. 2424 // controlled through policy.
2424 chromeos::AccessibilityManager* accessibility_manager = 2425 chromeos::AccessibilityManager* accessibility_manager =
2425 chromeos::AccessibilityManager::Get(); 2426 chromeos::AccessibilityManager::Get();
2426 2427
2427 // Manually enable the on-screen keyboard. 2428 // Manually enable the on-screen keyboard.
2428 accessibility_manager->EnableVirtualKeyboard(true); 2429 accessibility_manager->EnableVirtualKeyboard(true);
2429 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled()); 2430 EXPECT_TRUE(accessibility_manager->IsVirtualKeyboardEnabled());
2430 2431
2431 // Verify that policy overrides the manual setting. 2432 // Verify that policy overrides the manual setting.
2432 PolicyMap policies; 2433 PolicyMap policies;
2433 policies.Set(key::kVirtualKeyboardEnabled, POLICY_LEVEL_MANDATORY, 2434 policies.Set(key::kVirtualKeyboardEnabled, POLICY_LEVEL_MANDATORY,
2434 POLICY_SCOPE_USER, 2435 POLICY_SCOPE_USER,
2435 base::Value::CreateBooleanValue(false), NULL); 2436 base::Value::CreateBooleanValue(false), NULL);
2436 UpdateProviderPolicy(policies); 2437 UpdateProviderPolicy(policies);
2437 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); 2438 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled());
2438 2439
2439 // Verify that the on-screen keyboard cannot be enabled manually anymore. 2440 // Verify that the on-screen keyboard cannot be enabled manually anymore.
2440 accessibility_manager->EnableVirtualKeyboard(true); 2441 accessibility_manager->EnableVirtualKeyboard(true);
2441 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled()); 2442 EXPECT_FALSE(accessibility_manager->IsVirtualKeyboardEnabled());
2442 } 2443 }
2443 2444
2445 IN_PROC_BROWSER_TEST_F(PolicyTest, VirtualKeyboardEnabled) {
2446 // Verify keyboard disabled by default.
2447 EXPECT_FALSE(keyboard::IsKeyboardEnabled());
2448 // Verify keyboard can be toggled by default.
2449 keyboard::SetTouchKeyboardEnabled(true);
2450 EXPECT_TRUE(keyboard::IsKeyboardEnabled());
2451 keyboard::SetTouchKeyboardEnabled(false);
2452 EXPECT_FALSE(keyboard::IsKeyboardEnabled());
2453
2454 // Verify enabling the policy takes effect immediately and that that user
2455 // cannot disable the keyboard..
2456 PolicyMap policies;
2457 policies.Set(key::kTouchVirtualKeyboardEnabled,
2458 POLICY_LEVEL_MANDATORY,
2459 POLICY_SCOPE_USER,
2460 base::Value::CreateBooleanValue(true),
2461 NULL);
2462 UpdateProviderPolicy(policies);
2463 EXPECT_TRUE(keyboard::IsKeyboardEnabled());
2464 keyboard::SetTouchKeyboardEnabled(false);
2465 EXPECT_TRUE(keyboard::IsKeyboardEnabled());
2466
2467 // Verify that disabling the policy takes effect immediately and that the user
2468 // cannot enable the keyboard.
2469 policies.Set(key::kTouchVirtualKeyboardEnabled,
2470 POLICY_LEVEL_MANDATORY,
2471 POLICY_SCOPE_USER,
2472 base::Value::CreateBooleanValue(false),
2473 NULL);
2474 UpdateProviderPolicy(policies);
2475 EXPECT_FALSE(keyboard::IsKeyboardEnabled());
2476 keyboard::SetTouchKeyboardEnabled(true);
2477 EXPECT_FALSE(keyboard::IsKeyboardEnabled());
2478 }
2479
2444 #endif 2480 #endif
2445 2481
2446 namespace { 2482 namespace {
2447 2483
2448 static const char* kRestoredURLs[] = { 2484 static const char* kRestoredURLs[] = {
2449 "http://aaa.com/empty.html", 2485 "http://aaa.com/empty.html",
2450 "http://bbb.com/empty.html", 2486 "http://bbb.com/empty.html",
2451 }; 2487 };
2452 2488
2453 bool IsNonSwitchArgument(const CommandLine::StringType& s) { 2489 bool IsNonSwitchArgument(const CommandLine::StringType& s) {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 PrefService* prefs = browser()->profile()->GetPrefs(); 3011 PrefService* prefs = browser()->profile()->GetPrefs();
2976 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( 3012 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed(
2977 prefs, "host.name")); 3013 prefs, "host.name"));
2978 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( 3014 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed(
2979 prefs, "other.host.name")); 3015 prefs, "other.host.name"));
2980 } 3016 }
2981 3017
2982 #endif // !defined(CHROME_OS) 3018 #endif // !defined(CHROME_OS)
2983 3019
2984 } // namespace policy 3020 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698