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

Side by Side Diff: chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc

Issue 1468423003: Construct USB descriptors over explicit values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Android code. Created 4 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 | « no previous file | chrome/browser/devtools/device/usb/android_usb_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/printer_detector/printer_detector.h" 5 #include "chrome/browser/chromeos/printer_detector/printer_detector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( 114 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting(
115 user, profile_.get()); 115 user, profile_.get());
116 chromeos::PrinterDetectorFactory::GetInstance() 116 chromeos::PrinterDetectorFactory::GetInstance()
117 ->Get(profile_.get()) 117 ->Get(profile_.get())
118 ->SetNotificationUIManagerForTesting(&notification_ui_manager_); 118 ->SetNotificationUIManagerForTesting(&notification_ui_manager_);
119 } 119 }
120 120
121 void InvokeUsbAdded(uint16_t vendor_id, 121 void InvokeUsbAdded(uint16_t vendor_id,
122 uint16_t product_id, 122 uint16_t product_id,
123 uint8_t interface_class) { 123 uint8_t interface_class) {
124 device::UsbInterfaceDescriptor interface; 124 device::UsbConfigDescriptor config(1, false, false, 0);
125 interface.interface_number = 1; 125 config.interfaces.emplace_back(1, 0, interface_class, 0, 0);
126 interface.interface_class = interface_class;
127 device::UsbConfigDescriptor config;
128 config.interfaces.push_back(interface);
129 usb_service_.AddDevice( 126 usb_service_.AddDevice(
130 new device::MockUsbDevice(vendor_id, product_id, config)); 127 new device::MockUsbDevice(vendor_id, product_id, config));
131 } 128 }
132 129
133 // Creates a test extension with the provided permissions. 130 // Creates a test extension with the provided permissions.
134 scoped_refptr<extensions::Extension> CreateTestExtension( 131 scoped_refptr<extensions::Extension> CreateTestExtension(
135 ListBuilder permissions_builder, 132 ListBuilder permissions_builder,
136 DictionaryBuilder usb_printers_builder) { 133 DictionaryBuilder usb_printers_builder) {
137 return extensions::ExtensionBuilder() 134 return extensions::ExtensionBuilder()
138 .SetID("fake_extension_id") 135 .SetID("fake_extension_id")
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 .Set("interfaceClass", kPrinterInterfaceClass))))))); 328 .Set("interfaceClass", kPrinterInterfaceClass)))))));
332 ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) 329 ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
333 ->AddEnabled(extension)); 330 ->AddEnabled(extension));
334 331
335 InvokeUsbAdded(123, 456, 1); 332 InvokeUsbAdded(123, 456, 1);
336 333
337 ASSERT_EQ(0u, notification_ui_manager_.GetNotificationCount()); 334 ASSERT_EQ(0u, notification_ui_manager_.GetNotificationCount());
338 } 335 }
339 336
340 } // namespace chromeos 337 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/device/usb/android_usb_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698