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

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

Issue 881363004: Remove extra call to UsbDeviceHandle::Close in chrome.usb.closeDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « extensions/browser/api/usb/usb_api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/usb_service.h" 8 #include "device/usb/usb_service.h"
9 #include "extensions/browser/api/usb/usb_api.h" 9 #include "extensions/browser/api/usb/usb_api.h"
10 #include "extensions/shell/test/shell_apitest.h" 10 #include "extensions/shell/test/shell_apitest.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 protected: 194 protected:
195 scoped_refptr<MockUsbDeviceHandle> mock_device_handle_; 195 scoped_refptr<MockUsbDeviceHandle> mock_device_handle_;
196 scoped_refptr<MockUsbDevice> mock_device_; 196 scoped_refptr<MockUsbDevice> mock_device_;
197 MockUsbService* mock_service_; 197 MockUsbService* mock_service_;
198 }; 198 };
199 199
200 } // namespace 200 } // namespace
201 201
202 IN_PROC_BROWSER_TEST_F(UsbApiTest, DeviceHandling) { 202 IN_PROC_BROWSER_TEST_F(UsbApiTest, DeviceHandling) {
203 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(4); 203 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(2);
204 ASSERT_TRUE(RunAppTest("api_test/usb/device_handling")); 204 ASSERT_TRUE(RunAppTest("api_test/usb/device_handling"));
205 } 205 }
206 206
207 IN_PROC_BROWSER_TEST_F(UsbApiTest, ResetDevice) { 207 IN_PROC_BROWSER_TEST_F(UsbApiTest, ResetDevice) {
208 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(2); 208 EXPECT_CALL(*mock_device_handle_.get(), Close()).Times(2);
209 EXPECT_CALL(*mock_device_handle_.get(), ResetDevice()) 209 EXPECT_CALL(*mock_device_handle_.get(), ResetDevice())
210 .WillOnce(Return(true)) 210 .WillOnce(Return(true))
211 .WillOnce(Return(false)); 211 .WillOnce(Return(false));
212 EXPECT_CALL(*mock_device_handle_.get(), 212 EXPECT_CALL(*mock_device_handle_.get(),
213 InterruptTransfer(device::USB_DIRECTION_OUTBOUND, 2, _, 1, _, _)) 213 InterruptTransfer(device::USB_DIRECTION_OUTBOUND, 2, _, 1, _, _))
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 base::Bind(&MockUsbService::NotifyDeviceRemoved, 315 base::Bind(&MockUsbService::NotifyDeviceRemoved,
316 base::Unretained(mock_service_), mock_device_), 316 base::Unretained(mock_service_), mock_device_),
317 run_loop.QuitClosure()); 317 run_loop.QuitClosure());
318 run_loop.Run(); 318 run_loop.Run();
319 319
320 ASSERT_TRUE(result_listener.WaitUntilSatisfied()); 320 ASSERT_TRUE(result_listener.WaitUntilSatisfied());
321 ASSERT_EQ("success", result_listener.message()); 321 ASSERT_EQ("success", result_listener.message());
322 } 322 }
323 323
324 } // namespace extensions 324 } // namespace extensions
OLDNEW
« no previous file with comments | « 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