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

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

Issue 11926005: Fix transfer length validation in Usb Api. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 (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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 111
112 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferFailure) { 112 IN_PROC_BROWSER_TEST_F(UsbApiTest, TransferFailure) {
113 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, _, _, _)) 113 EXPECT_CALL(*mock_device_, BulkTransfer(_, _, _, _, _, _))
114 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED)) 114 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_COMPLETED))
115 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_ERROR)) 115 .WillOnce(InvokeUsbTransferCallback<5>(USB_TRANSFER_ERROR))
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
121 IN_PROC_BROWSER_TEST_F(UsbApiTest, InvalidLengthTransfer) {
122 EXPECT_CALL(*mock_device_, Close(_)).Times(AnyNumber());
123 ASSERT_TRUE(RunExtensionTest("usb/invalid_length_transfer"));
124 }
125
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698