| OLD | NEW |
| (Empty) |
| 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 | |
| 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 // TODO(rockot): Enable tests once ChromeOS HID testing hardware is in place. | |
| 17 #if defined(OS_CHROMEOS) | |
| 18 #define MAYBE_Create DISABLED_Create | |
| 19 #else | |
| 20 #define MAYBE_Create Create | |
| 21 #endif | |
| 22 | |
| 23 namespace device { | |
| 24 | |
| 25 namespace { | |
| 26 | |
| 27 const int kUSBLUFADemoVID = 0x03eb; | |
| 28 const int kUSBLUFADemoPID = 0x204f; | |
| 29 | |
| 30 } // namespace | |
| 31 | |
| 32 TEST(HidServiceTest, MAYBE_Create) { | |
| 33 base::MessageLoopForIO message_loop; | |
| 34 HidService* service = HidService::GetInstance(); | |
| 35 ASSERT_TRUE(service); | |
| 36 | |
| 37 std::vector<HidDeviceInfo> devices; | |
| 38 service->GetDevices(&devices); | |
| 39 std::string target_device; | |
| 40 | |
| 41 for (std::vector<HidDeviceInfo>::iterator it = devices.begin(); | |
| 42 it != devices.end(); | |
| 43 ++it) { | |
| 44 if (it->vendor_id == kUSBLUFADemoVID && it->product_id == kUSBLUFADemoPID) { | |
| 45 target_device = it->device_id; | |
| 46 break; | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 if (devices.size() > 0) { | |
| 51 EXPECT_NE(std::string(""), target_device); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 } // namespace device | |
| OLD | NEW |