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

Side by Side Diff: ash/virtual_keyboard_controller_unittest.cc

Issue 800933002: Turns on smart deployment of the virtual keyboard by default, and changes the flag to allow easy di… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « ash/virtual_keyboard_controller.cc ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/virtual_keyboard_controller.h" 5 #include "ash/virtual_keyboard_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" 8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 22 matching lines...) Expand all
33 manager->OnTouchscreenDevicesUpdated(touchscreen_devices); 33 manager->OnTouchscreenDevicesUpdated(touchscreen_devices);
34 } 34 }
35 35
36 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) { 36 void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) {
37 ui::DeviceHotplugEventObserver* manager = 37 ui::DeviceHotplugEventObserver* manager =
38 ui::DeviceDataManager::GetInstance(); 38 ui::DeviceDataManager::GetInstance();
39 manager->OnKeyboardDevicesUpdated(keyboard_devices); 39 manager->OnKeyboardDevicesUpdated(keyboard_devices);
40 } 40 }
41 41
42 void SetUp() override { 42 void SetUp() override {
43 CommandLine::ForCurrentProcess()->AppendSwitch(
44 keyboard::switches::kDisableSmartVirtualKeyboard);
43 AshTestBase::SetUp(); 45 AshTestBase::SetUp();
44 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); 46 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
45 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); 47 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
46 } 48 }
47 49
48 private: 50 private:
49 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); 51 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest);
50 }; 52 };
51 53
52 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { 54 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) {
(...skipping 10 matching lines...) Expand all
63 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); 65 EXPECT_FALSE(keyboard::IsKeyboardEnabled());
64 } 66 }
65 67
66 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, 68 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
67 public VirtualKeyboardObserver { 69 public VirtualKeyboardObserver {
68 public: 70 public:
69 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} 71 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {}
70 ~VirtualKeyboardControllerAutoTest() override {} 72 ~VirtualKeyboardControllerAutoTest() override {}
71 73
72 void SetUp() override { 74 void SetUp() override {
73 CommandLine::ForCurrentProcess()->AppendSwitch( 75 AshTestBase::SetUp();
74 keyboard::switches::kAutoVirtualKeyboard); 76 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
75 VirtualKeyboardControllerTest::SetUp(); 77 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
sadrul 2014/12/12 21:22:44 Add a comment explaining why these are necessary.
rsadam 2014/12/12 22:10:22 Done.
76 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( 78 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver(
77 this); 79 this);
78 } 80 }
79 81
80 void TearDown() override { 82 void TearDown() override {
81 Shell::GetInstance()->system_tray_notifier()->RemoveVirtualKeyboardObserver( 83 Shell::GetInstance()->system_tray_notifier()->RemoveVirtualKeyboardObserver(
82 this); 84 this);
83 AshTestBase::TearDown(); 85 AshTestBase::TearDown();
84 } 86 }
85 87
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 keyboards.push_back(ui::KeyboardDevice( 195 keyboards.push_back(ui::KeyboardDevice(
194 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); 196 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
195 keyboards.push_back(ui::KeyboardDevice( 197 keyboards.push_back(ui::KeyboardDevice(
196 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); 198 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
197 UpdateKeyboardDevices(keyboards); 199 UpdateKeyboardDevices(keyboards);
198 ASSERT_FALSE(keyboard::IsKeyboardEnabled()); 200 ASSERT_FALSE(keyboard::IsKeyboardEnabled());
199 } 201 }
200 202
201 } // namespace test 203 } // namespace test
202 } // namespace ash 204 } // namespace ash
OLDNEW
« no previous file with comments | « ash/virtual_keyboard_controller.cc ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698