This source file includes following definitions.
- TEST_F
#include "chrome/browser/usb/usb_context.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libusb/src/libusb/libusb.h"
namespace {
class UsbContextTest : public testing::Test {
protected:
class UsbContextForTest : public UsbContext {
public:
explicit UsbContextForTest(PlatformUsbContext context)
: UsbContext(context) {}
private:
virtual ~UsbContextForTest() {}
DISALLOW_COPY_AND_ASSIGN(UsbContextForTest);
};
};
}
#if defined(OS_LINUX)
#define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
#elif defined(OS_ANDROID)
#define MAYBE_GracefulShutdown DISABLED_GracefulShutdown
#else
#define MAYBE_GracefulShutdown GracefulShutdown
#endif
TEST_F(UsbContextTest, MAYBE_GracefulShutdown) {
base::TimeTicks start = base::TimeTicks::Now();
{
PlatformUsbContext platform_context;
ASSERT_EQ(LIBUSB_SUCCESS, libusb_init(&platform_context));
scoped_refptr<UsbContextForTest> context(
new UsbContextForTest(platform_context));
}
base::TimeDelta elapse = base::TimeTicks::Now() - start;
if (elapse > base::TimeDelta::FromSeconds(2)) {
FAIL();
}
}