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 "base/threading/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "components/usb_service/usb_context.h" | 7 #include "device/usb/usb_context.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "third_party/libusb/src/libusb/libusb.h" | 9 #include "third_party/libusb/src/libusb/libusb.h" |
10 | 10 |
11 using usb_service::UsbContext; | 11 namespace device { |
12 using usb_service::PlatformUsbContext; | |
13 | 12 |
14 namespace { | 13 namespace { |
15 | 14 |
16 class UsbContextTest : public testing::Test { | 15 class UsbContextTest : public testing::Test { |
17 protected: | 16 protected: |
18 class UsbContextForTest : public UsbContext { | 17 class UsbContextForTest : public UsbContext { |
19 public: | 18 public: |
20 explicit UsbContextForTest(PlatformUsbContext context) | 19 explicit UsbContextForTest(PlatformUsbContext context) |
21 : UsbContext(context) {} | 20 : UsbContext(context) {} |
22 | 21 |
(...skipping 21 matching lines...) Expand all Loading... |
44 PlatformUsbContext platform_context; | 43 PlatformUsbContext platform_context; |
45 ASSERT_EQ(LIBUSB_SUCCESS, libusb_init(&platform_context)); | 44 ASSERT_EQ(LIBUSB_SUCCESS, libusb_init(&platform_context)); |
46 scoped_refptr<UsbContextForTest> context( | 45 scoped_refptr<UsbContextForTest> context( |
47 new UsbContextForTest(platform_context)); | 46 new UsbContextForTest(platform_context)); |
48 } | 47 } |
49 base::TimeDelta elapse = base::TimeTicks::Now() - start; | 48 base::TimeDelta elapse = base::TimeTicks::Now() - start; |
50 if (elapse > base::TimeDelta::FromSeconds(2)) { | 49 if (elapse > base::TimeDelta::FromSeconds(2)) { |
51 FAIL(); | 50 FAIL(); |
52 } | 51 } |
53 } | 52 } |
| 53 |
| 54 } // namespace device |
OLD | NEW |