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

Side by Side Diff: device/usb/mock_usb_device.h

Issue 2269993004: Add unit test for UsbChooserController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@modify_UsbDeviceFilter_MatchesAny
Patch Set: address more comment Created 4 years, 3 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 | « chrome/chrome_tests_unit.gypi ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef DEVICE_USB_MOCK_USB_DEVICE_H_ 5 #ifndef DEVICE_USB_MOCK_USB_DEVICE_H_
6 #define DEVICE_USB_MOCK_USB_DEVICE_H_ 6 #define DEVICE_USB_MOCK_USB_DEVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "device/usb/usb_device.h" 14 #include "device/usb/usb_device.h"
14 #include "device/usb/usb_device_handle.h" 15 #include "device/usb/usb_device_handle.h"
16 #include "device/usb/webusb_descriptors.h"
15 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
16 18
17 namespace device { 19 namespace device {
18 20
19 class MockUsbDevice : public UsbDevice { 21 class MockUsbDevice : public UsbDevice {
20 public: 22 public:
21 MockUsbDevice(uint16_t vendor_id, uint16_t product_id); 23 MockUsbDevice(uint16_t vendor_id, uint16_t product_id);
22 MockUsbDevice(uint16_t vendor_id, 24 MockUsbDevice(uint16_t vendor_id,
23 uint16_t product_id, 25 uint16_t product_id,
24 const std::string& manufacturer_string, 26 const std::string& manufacturer_string,
(...skipping 12 matching lines...) Expand all
37 uint16_t product_id, 39 uint16_t product_id,
38 const std::string& manufacturer_string, 40 const std::string& manufacturer_string,
39 const std::string& product_string, 41 const std::string& product_string,
40 const std::string& serial_number, 42 const std::string& serial_number,
41 const std::vector<UsbConfigDescriptor>& configurations); 43 const std::vector<UsbConfigDescriptor>& configurations);
42 44
43 MOCK_METHOD1(Open, void(const OpenCallback&)); 45 MOCK_METHOD1(Open, void(const OpenCallback&));
44 46
45 void AddMockConfig(const UsbConfigDescriptor& config); 47 void AddMockConfig(const UsbConfigDescriptor& config);
46 48
49 void set_webusb_allowed_origins(
50 std::unique_ptr<WebUsbAllowedOrigins> webusb_allowed_origins) {
51 webusb_allowed_origins_ = std::move(webusb_allowed_origins);
52 }
53
47 // Public wrappers around protected functions. 54 // Public wrappers around protected functions.
48 void ActiveConfigurationChanged(int configuration_value); 55 void ActiveConfigurationChanged(int configuration_value);
49 void NotifyDeviceRemoved(); 56 void NotifyDeviceRemoved();
50 57
51 private: 58 private:
52 ~MockUsbDevice() override; 59 ~MockUsbDevice() override;
53 }; 60 };
54 61
55 } // namespace device 62 } // namespace device
56 63
57 #endif // DEVICE_USB_MOCK_USB_DEVICE_H_ 64 #endif // DEVICE_USB_MOCK_USB_DEVICE_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698