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

Side by Side Diff: extensions/browser/api/usb/usb_apitest.cc

Issue 1265833005: Get all the UsbConfigDescriptor for the device configuration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use const auto Created 5 years, 4 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
OLDNEW
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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "content/public/browser/browser_thread.h" 6 #include "content/public/browser/browser_thread.h"
7 #include "content/public/test/test_utils.h" 7 #include "content/public/test/test_utils.h"
8 #include "device/usb/mock_usb_device.h" 8 #include "device/usb/mock_usb_device.h"
9 #include "device/usb/mock_usb_device_handle.h" 9 #include "device/usb/mock_usb_device_handle.h"
10 #include "device/usb/mock_usb_service.h" 10 #include "device/usb/mock_usb_service.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 InterruptTransfer(device::USB_DIRECTION_OUTBOUND, 2, _, 1, _, _)) 113 InterruptTransfer(device::USB_DIRECTION_OUTBOUND, 2, _, 1, _, _))
114 .WillOnce(InvokeUsbTransferCallback<5>(device::USB_TRANSFER_COMPLETED)); 114 .WillOnce(InvokeUsbTransferCallback<5>(device::USB_TRANSFER_COMPLETED));
115 ASSERT_TRUE(RunAppTest("api_test/usb/reset_device")); 115 ASSERT_TRUE(RunAppTest("api_test/usb/reset_device"));
116 } 116 }
117 117
118 IN_PROC_BROWSER_TEST_F(UsbApiTest, SetConfiguration) { 118 IN_PROC_BROWSER_TEST_F(UsbApiTest, SetConfiguration) {
119 UsbConfigDescriptor config_descriptor; 119 UsbConfigDescriptor config_descriptor;
120 EXPECT_CALL(*mock_device_handle_.get(), SetConfiguration(1, _)) 120 EXPECT_CALL(*mock_device_handle_.get(), SetConfiguration(1, _))
121 .WillOnce(InvokeCallback<1>(true)); 121 .WillOnce(InvokeCallback<1>(true));
122 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1); 122 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1);
123 EXPECT_CALL(*mock_device_.get(), GetConfiguration()) 123 EXPECT_CALL(*mock_device_.get(), GetActiveConfiguration())
124 .WillOnce(Return(nullptr)) 124 .WillOnce(Return(nullptr))
125 .WillOnce(Return(&config_descriptor)); 125 .WillOnce(Return(&config_descriptor));
126 ASSERT_TRUE(RunAppTest("api_test/usb/set_configuration")); 126 ASSERT_TRUE(RunAppTest("api_test/usb/set_configuration"));
127 } 127 }
128 128
129 IN_PROC_BROWSER_TEST_F(UsbApiTest, ListInterfaces) { 129 IN_PROC_BROWSER_TEST_F(UsbApiTest, ListInterfaces) {
130 UsbConfigDescriptor config_descriptor; 130 UsbConfigDescriptor config_descriptor;
131 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1); 131 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(1);
132 EXPECT_CALL(*mock_device_.get(), GetConfiguration()) 132 EXPECT_CALL(*mock_device_.get(), GetActiveConfiguration())
133 .WillOnce(Return(&config_descriptor)); 133 .WillOnce(Return(&config_descriptor));
134 ASSERT_TRUE(RunAppTest("api_test/usb/list_interfaces")); 134 ASSERT_TRUE(RunAppTest("api_test/usb/list_interfaces"));
135 } 135 }
136 136
137 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferEvent) { 137 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferEvent) {
138 EXPECT_CALL(*mock_device_handle_.get(), 138 EXPECT_CALL(*mock_device_handle_.get(),
139 ControlTransfer(device::USB_DIRECTION_OUTBOUND, 139 ControlTransfer(device::USB_DIRECTION_OUTBOUND,
140 UsbDeviceHandle::STANDARD, 140 UsbDeviceHandle::STANDARD,
141 UsbDeviceHandle::DEVICE, 141 UsbDeviceHandle::DEVICE,
142 1, 142 1,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 TestExtensionsAPIClient test_api_client; 226 TestExtensionsAPIClient test_api_client;
227 ASSERT_TRUE(LoadApp("api_test/usb/get_user_selected_devices")); 227 ASSERT_TRUE(LoadApp("api_test/usb/get_user_selected_devices"));
228 ASSERT_TRUE(ready_listener.WaitUntilSatisfied()); 228 ASSERT_TRUE(ready_listener.WaitUntilSatisfied());
229 229
230 mock_service_->RemoveDevice(mock_device_); 230 mock_service_->RemoveDevice(mock_device_);
231 ASSERT_TRUE(result_listener.WaitUntilSatisfied()); 231 ASSERT_TRUE(result_listener.WaitUntilSatisfied());
232 } 232 }
233 233
234 } // namespace extensions 234 } // namespace extensions
OLDNEW
« device/devices_app/usb/device_impl.cc ('K') | « extensions/browser/api/usb/usb_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698