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

Side by Side Diff: chrome/browser/usb/usb_context_unittest.cc

Issue 236203019: Move UsbService to its own component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move usb_service component symbols into usb_service namespace Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/usb/usb_context.cc ('k') | chrome/browser/usb/usb_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 "chrome/browser/usb/usb_context.h"
6
7 #include "base/threading/platform_thread.h"
8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/libusb/src/libusb/libusb.h"
11
12 namespace {
13
14 class UsbContextTest : public testing::Test {
15 protected:
16 class UsbContextForTest : public UsbContext {
17 public:
18 explicit UsbContextForTest(PlatformUsbContext context)
19 : UsbContext(context) {}
20 private:
21 virtual ~UsbContextForTest() {}
22 DISALLOW_COPY_AND_ASSIGN(UsbContextForTest);
23 };
24 };
25
26 } // namespace
27
28 #if defined(OS_LINUX)
29 // Linux trybot does not support usb.
30 #define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
31 #elif defined(OS_ANDROID)
32 // Android build does not include usb support.
33 #define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
34 #else
35 #define MAYBE_GracefulShutdown GracefulShutdown
36 #endif
37
38 TEST_F(UsbContextTest, MAYBE_GracefulShutdown) {
39 base::TimeTicks start = base::TimeTicks::Now();
40 {
41 PlatformUsbContext platform_context;
42 ASSERT_EQ(LIBUSB_SUCCESS, libusb_init(&platform_context));
43 scoped_refptr<UsbContextForTest> context(
44 new UsbContextForTest(platform_context));
45 }
46 base::TimeDelta elapse = base::TimeTicks::Now() - start;
47 if (elapse > base::TimeDelta::FromSeconds(2)) {
48 FAIL();
49 }
50 }
OLDNEW
« no previous file with comments | « chrome/browser/usb/usb_context.cc ('k') | chrome/browser/usb/usb_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698