| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_descriptor_watcher_posix.h" |
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" |
| 10 #include "device/hid/input_service_linux.h" | 12 #include "device/hid/input_service_linux.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 14 |
| 13 namespace device { | 15 namespace device { |
| 14 | 16 |
| 15 TEST(InputServiceLinux, Simple) { | 17 TEST(InputServiceLinux, Simple) { |
| 16 base::MessageLoopForIO message_loop; | 18 base::MessageLoopForIO message_loop; |
| 19 base::FileDescriptorWatcher file_descriptor_watcher(&message_loop); |
| 20 |
| 17 InputServiceLinux* service = InputServiceLinux::GetInstance(); | 21 InputServiceLinux* service = InputServiceLinux::GetInstance(); |
| 18 | 22 |
| 23 // Allow the FileDescriptorWatcher in DeviceMonitorLinux to start watching. |
| 24 base::RunLoop().RunUntilIdle(); |
| 25 |
| 19 ASSERT_TRUE(service); | 26 ASSERT_TRUE(service); |
| 20 std::vector<InputServiceLinux::InputDeviceInfo> devices; | 27 std::vector<InputServiceLinux::InputDeviceInfo> devices; |
| 21 service->GetDevices(&devices); | 28 service->GetDevices(&devices); |
| 22 for (size_t i = 0; i < devices.size(); ++i) | 29 for (size_t i = 0; i < devices.size(); ++i) |
| 23 ASSERT_TRUE(!devices[i].id.empty()); | 30 ASSERT_TRUE(!devices[i].id.empty()); |
| 24 } | 31 } |
| 25 | 32 |
| 26 } // namespace device | 33 } // namespace device |
| OLD | NEW |