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

Unified Diff: ash/virtual_keyboard_controller_unittest.cc

Issue 2019413002: Remove KeyboardDevice class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for comments. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/virtual_keyboard_controller_unittest.cc
diff --git a/ash/virtual_keyboard_controller_unittest.cc b/ash/virtual_keyboard_controller_unittest.cc
index bdae09ec4223547bc2e90577720841eafa294403..0bab2863f22898b1c2354775df60a3bc3385df2e 100644
--- a/ash/virtual_keyboard_controller_unittest.cc
+++ b/ash/virtual_keyboard_controller_unittest.cc
@@ -17,7 +17,6 @@
#include "ui/events/devices/device_data_manager.h"
#include "ui/events/devices/device_hotplug_event_observer.h"
#include "ui/events/devices/input_device.h"
-#include "ui/events/devices/keyboard_device.h"
#include "ui/events/devices/touchscreen_device.h"
#include "ui/keyboard/keyboard_export.h"
#include "ui/keyboard/keyboard_switches.h"
@@ -38,7 +37,7 @@ class VirtualKeyboardControllerTest : public AshTestBase {
manager->OnTouchscreenDevicesUpdated(touchscreen_devices);
}
- void UpdateKeyboardDevices(std::vector<ui::KeyboardDevice> keyboard_devices) {
+ void UpdateKeyboardDevices(std::vector<ui::InputDevice> keyboard_devices) {
ui::DeviceHotplugEventObserver* manager =
ui::DeviceDataManager::GetInstance();
manager->OnKeyboardDevicesUpdated(keyboard_devices);
@@ -55,7 +54,7 @@ class VirtualKeyboardControllerTest : public AshTestBase {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kDisableSmartVirtualKeyboard);
AshTestBase::SetUp();
- UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
+ UpdateKeyboardDevices(std::vector<ui::InputDevice>());
UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
}
@@ -83,12 +82,12 @@ class MockEventBlocker : public ScopedDisableInternalMouseAndKeyboard {
public:
MockEventBlocker() {}
~MockEventBlocker() override {
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
ui::DeviceHotplugEventObserver* manager =
ui::DeviceDataManager::GetInstance();
- manager->OnKeyboardDevicesUpdated(keyboards);
+ manager->OnKeyboardDevicesUpdated(keyboard_devices);
}
private:
@@ -117,7 +116,7 @@ class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
AshTestBase::SetUp();
// Set the current list of devices to empty so that they don't interfere
// with the test.
- UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
+ UpdateKeyboardDevices(std::vector<ui::InputDevice>());
UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver(
this);
@@ -161,16 +160,16 @@ TEST_F(VirtualKeyboardControllerAutoTest, DisabledIfInternalKeyboardPresent) {
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
// Remove the internal keyboard. Virtual keyboard should now show.
- UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
+ UpdateKeyboardDevices(std::vector<ui::InputDevice>());
EXPECT_TRUE(keyboard::IsKeyboardEnabled());
// Replug in the internal keyboard. Virtual keyboard should hide.
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
EXPECT_FALSE(keyboard::IsKeyboardEnabled());
}
@@ -193,10 +192,10 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedIfExternalKeyboardPresent) {
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
ASSERT_TRUE(notified());
ASSERT_TRUE(IsVirtualKeyboardSuppressed());
@@ -219,7 +218,7 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedIfExternalKeyboardPresent) {
// Remove external keyboard. Should be notified that the keyboard is not
// suppressed.
ResetObserver();
- UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
+ UpdateKeyboardDevices(std::vector<ui::InputDevice>());
ASSERT_TRUE(keyboard::IsKeyboardEnabled());
ASSERT_TRUE(notified());
ASSERT_FALSE(IsVirtualKeyboardSuppressed());
@@ -227,12 +226,12 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedIfExternalKeyboardPresent) {
// Tests handling multiple keyboards. Catches crbug.com/430252
TEST_F(VirtualKeyboardControllerAutoTest, HandleMultipleKeyboardsPresent) {
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboards;
+ keyboards.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
- keyboards.push_back(ui::KeyboardDevice(
+ keyboards.push_back(ui::InputDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
- keyboards.push_back(ui::KeyboardDevice(
+ keyboards.push_back(ui::InputDevice(
3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
UpdateKeyboardDevices(keyboards);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
@@ -245,10 +244,10 @@ TEST_F(VirtualKeyboardControllerAutoTest, EnabledDuringMaximizeMode) {
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
ASSERT_FALSE(keyboard::IsKeyboardEnabled());
// Toggle maximized mode on.
Shell::GetInstance()
@@ -269,12 +268,12 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedInMaximizedMode) {
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "Keyboard"));
- keyboards.push_back(ui::KeyboardDevice(
+ keyboard_devices.push_back(ui::InputDevice(
2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "Keyboard"));
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
// Toggle maximized mode on.
Shell::GetInstance()
->maximize_mode_controller()
@@ -301,8 +300,8 @@ TEST_F(VirtualKeyboardControllerAutoTest, SuppressedInMaximizedMode) {
// Remove external keyboard. Should be notified that the keyboard is not
// suppressed.
ResetObserver();
- keyboards.pop_back();
- UpdateKeyboardDevices(keyboards);
+ keyboard_devices.pop_back();
+ UpdateKeyboardDevices(keyboard_devices);
ASSERT_TRUE(keyboard::IsKeyboardEnabled());
ASSERT_TRUE(notified());
ASSERT_FALSE(IsVirtualKeyboardSuppressed());
@@ -338,10 +337,10 @@ TEST_F(VirtualKeyboardControllerAlwaysEnabledTest, DoesNotSuppressKeyboard) {
ui::TouchscreenDevice(1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL,
"Touchscreen", gfx::Size(1024, 768), 0));
UpdateTouchscreenDevices(screens);
- std::vector<ui::KeyboardDevice> keyboards;
- keyboards.push_back(ui::KeyboardDevice(
+ std::vector<ui::InputDevice> keyboard_devices;
+ keyboard_devices.push_back(ui::InputDevice(
1, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
- UpdateKeyboardDevices(keyboards);
+ UpdateKeyboardDevices(keyboard_devices);
ASSERT_TRUE(keyboard::IsKeyboardEnabled());
}
« no previous file with comments | « ash/virtual_keyboard_controller.cc ('k') | ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698