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.
5 #include "chrome/browser/usb/usb_context.h"
7 #include "base/threading/platform_thread.h"
8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 class UsbContextTest
: public testing::Test
{
15 class UsbContextForTest
: public UsbContext
{
17 UsbContextForTest() : UsbContext() {}
19 virtual ~UsbContextForTest() {}
20 DISALLOW_COPY_AND_ASSIGN(UsbContextForTest
);
27 // Linux trybot does not support usb.
28 #define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
29 #elif defined(OS_ANDROID)
30 // Android build does not include usb support.
31 #define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
33 #define MAYBE_GracefulShutdown GracefulShutdown
36 TEST_F(UsbContextTest
, MAYBE_GracefulShutdown
) {
37 base::TimeTicks start
= base::TimeTicks::Now();
39 scoped_refptr
<UsbContextForTest
> context(new UsbContextForTest());
41 base::TimeDelta elapse
= base::TimeTicks::Now() - start
;
42 if (elapse
> base::TimeDelta::FromSeconds(2)) {