| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <string> |
| 6 #include <vector> |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" |
| 11 #include "device/hid/hid_connection.h" |
| 12 #include "device/hid/hid_service.h" |
| 13 #include "net/base/io_buffer.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 |
| 16 namespace device { |
| 17 |
| 18 namespace { |
| 19 |
| 20 const int kUSBLUFADemoVID = 0x03eb; |
| 21 const int kUSBLUFADemoPID = 0x204f; |
| 22 |
| 23 } // namespace |
| 24 |
| 25 TEST(HidServiceTest, Create) { |
| 26 base::MessageLoopForIO message_loop; |
| 27 HidService* service = HidService::GetInstance(); |
| 28 ASSERT_TRUE(service); |
| 29 |
| 30 std::vector<HidDeviceInfo> devices; |
| 31 service->GetDevices(&devices); |
| 32 std::string target_device; |
| 33 ASSERT_GT(devices.size(), 0U) << "No device found"; |
| 34 |
| 35 for (std::vector<HidDeviceInfo>::iterator it = devices.begin(); |
| 36 it != devices.end(); |
| 37 ++it) { |
| 38 if (it->vendor_id == kUSBLUFADemoVID && it->product_id == kUSBLUFADemoPID) { |
| 39 target_device = it->device_id; |
| 40 break; |
| 41 } |
| 42 } |
| 43 |
| 44 EXPECT_NE(std::string(""), target_device); |
| 45 } |
| 46 |
| 47 } // namespace device |
| OLD | NEW |