| OLD | NEW |
| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" | 10 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Sets the event blocker on the maximized window controller. | 46 // Sets the event blocker on the maximized window controller. |
| 47 void SetEventBlocker( | 47 void SetEventBlocker( |
| 48 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) { | 48 scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) { |
| 49 Shell::GetInstance() | 49 Shell::GetInstance() |
| 50 ->maximize_mode_controller() | 50 ->maximize_mode_controller() |
| 51 ->event_blocker_ = blocker.Pass(); | 51 ->event_blocker_ = blocker.Pass(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void SetUp() override { | 54 void SetUp() override { |
| 55 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 56 keyboard::switches::kDisableSmartVirtualKeyboard); |
| 55 AshTestBase::SetUp(); | 57 AshTestBase::SetUp(); |
| 56 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); | 58 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
| 57 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 59 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
| 58 } | 60 } |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); | 63 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardControllerTest); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { | 66 TEST_F(VirtualKeyboardControllerTest, EnabledDuringMaximizeMode) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 SetEventBlocker(blocker.Pass()); | 107 SetEventBlocker(blocker.Pass()); |
| 106 } | 108 } |
| 107 | 109 |
| 108 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, | 110 class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, |
| 109 public VirtualKeyboardObserver { | 111 public VirtualKeyboardObserver { |
| 110 public: | 112 public: |
| 111 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} | 113 VirtualKeyboardControllerAutoTest() : notified_(false), suppressed_(false) {} |
| 112 ~VirtualKeyboardControllerAutoTest() override {} | 114 ~VirtualKeyboardControllerAutoTest() override {} |
| 113 | 115 |
| 114 void SetUp() override { | 116 void SetUp() override { |
| 115 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 116 keyboard::switches::kEnableAutoVirtualKeyboard); | |
| 117 AshTestBase::SetUp(); | 117 AshTestBase::SetUp(); |
| 118 // Set the current list of devices to empty so that they don't interfere | 118 // Set the current list of devices to empty so that they don't interfere |
| 119 // with the test. | 119 // with the test. |
| 120 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); | 120 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); |
| 121 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); | 121 UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); |
| 122 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( | 122 Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( |
| 123 this); | 123 this); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void TearDown() override { | 126 void TearDown() override { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 UpdateTouchscreenDevices(screens); | 265 UpdateTouchscreenDevices(screens); |
| 266 std::vector<ui::KeyboardDevice> keyboards; | 266 std::vector<ui::KeyboardDevice> keyboards; |
| 267 keyboards.push_back(ui::KeyboardDevice( | 267 keyboards.push_back(ui::KeyboardDevice( |
| 268 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); | 268 1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard")); |
| 269 UpdateKeyboardDevices(keyboards); | 269 UpdateKeyboardDevices(keyboards); |
| 270 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); | 270 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace test | 273 } // namespace test |
| 274 } // namespace ash | 274 } // namespace ash |
| OLD | NEW |