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

Side by Side Diff: services/ui/input_devices/input_device_unittests.cc

Issue 2805793002: ozone: evdev: Add gamepad support (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/test_mock_time_task_runner.h" 9 #include "base/test/test_mock_time_task_runner.h"
10 #include "services/ui/input_devices/input_device_server.h" 10 #include "services/ui/input_devices/input_device_server.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Add keyboard and mark device lists complete. 116 // Add keyboard and mark device lists complete.
117 GetHotplugObserver()->OnTouchscreenDevicesUpdated(AsVector({touchscreen})); 117 GetHotplugObserver()->OnTouchscreenDevicesUpdated(AsVector({touchscreen}));
118 GetHotplugObserver()->OnDeviceListsComplete(); 118 GetHotplugObserver()->OnDeviceListsComplete();
119 119
120 RunUntilIdle(); 120 RunUntilIdle();
121 EXPECT_TRUE(client.AreDeviceListsComplete()); 121 EXPECT_TRUE(client.AreDeviceListsComplete());
122 EXPECT_EQ(1u, client.GetTouchscreenDevices().size()); 122 EXPECT_EQ(1u, client.GetTouchscreenDevices().size());
123 EXPECT_EQ(0u, client.GetKeyboardDevices().size()); 123 EXPECT_EQ(0u, client.GetKeyboardDevices().size());
124 EXPECT_EQ(0u, client.GetMouseDevices().size()); 124 EXPECT_EQ(0u, client.GetMouseDevices().size());
125 EXPECT_EQ(0u, client.GetTouchpadDevices().size()); 125 EXPECT_EQ(0u, client.GetTouchpadDevices().size());
126 EXPECT_EQ(0u, client.GetGamepadDevices().size());
126 } 127 }
127 128
128 TEST_F(InputDeviceTest, AddDeviceAfterComplete) { 129 TEST_F(InputDeviceTest, AddDeviceAfterComplete) {
129 const InputDevice keyboard1(100, INPUT_DEVICE_INTERNAL, "Keyboard1"); 130 const InputDevice keyboard1(100, INPUT_DEVICE_INTERNAL, "Keyboard1");
130 const InputDevice keyboard2(200, INPUT_DEVICE_EXTERNAL, "Keyboard2"); 131 const InputDevice keyboard2(200, INPUT_DEVICE_EXTERNAL, "Keyboard2");
131 const InputDevice mouse(300, INPUT_DEVICE_EXTERNAL, "Mouse"); 132 const InputDevice mouse(300, INPUT_DEVICE_EXTERNAL, "Mouse");
132 133
133 TestInputDeviceClient client; 134 TestInputDeviceClient client;
134 AddClientAsObserver(&client); 135 AddClientAsObserver(&client);
135 136
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 EXPECT_EQ(1u, client.GetTouchpadDevices().size()); 190 EXPECT_EQ(1u, client.GetTouchpadDevices().size());
190 191
191 // Check the touchpad fields match. 192 // Check the touchpad fields match.
192 const InputDevice& output = client.GetTouchpadDevices()[0]; 193 const InputDevice& output = client.GetTouchpadDevices()[0];
193 EXPECT_EQ(touchpad.id, output.id); 194 EXPECT_EQ(touchpad.id, output.id);
194 EXPECT_EQ(touchpad.type, output.type); 195 EXPECT_EQ(touchpad.type, output.type);
195 EXPECT_EQ(touchpad.name, output.name); 196 EXPECT_EQ(touchpad.name, output.name);
196 } 197 }
197 198
198 } // namespace ui 199 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698