OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/usb/usb_api.h" | 5 #include "chrome/browser/extensions/api/usb/usb_api.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/usb/usb_service.h" | 8 #include "chrome/browser/usb/usb_service.h" |
9 #include "chrome/browser/usb/usb_service_factory.h" | 9 #include "chrome/browser/usb/usb_service_factory.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #pragma warning(pop) | 61 #pragma warning(pop) |
62 #endif | 62 #endif |
63 | 63 |
64 class UsbApiTest : public ExtensionApiTest { | 64 class UsbApiTest : public ExtensionApiTest { |
65 public: | 65 public: |
66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 66 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
67 ExtensionApiTest::SetUpCommandLine(command_line); | 67 ExtensionApiTest::SetUpCommandLine(command_line); |
68 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 68 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
69 } | 69 } |
70 | 70 |
71 void SetUpOnMainThread() OVERRIDE { | 71 virtual void SetUpOnMainThread() OVERRIDE { |
72 mock_device_ = new MockUsbDevice(); | 72 mock_device_ = new MockUsbDevice(); |
73 extensions::UsbFindDevicesFunction::SetDeviceForTest(mock_device_.get()); | 73 extensions::UsbFindDevicesFunction::SetDeviceForTest(mock_device_.get()); |
74 } | 74 } |
75 | 75 |
76 protected: | 76 protected: |
77 scoped_refptr<MockUsbDevice> mock_device_; | 77 scoped_refptr<MockUsbDevice> mock_device_; |
78 }; | 78 }; |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_TIMEOUT)); | 116 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_TIMEOUT)); |
117 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); | 117 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); |
118 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); | 118 ASSERT_TRUE(RunExtensionTest("usb/transfer_failure")); |
119 } | 119 } |
120 | 120 |
121 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { | 121 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) { |
122 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); | 122 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber()); |
123 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); | 123 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer")); |
124 } | 124 } |
125 | 125 |
OLD | NEW |