OLD | NEW |
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 Loading... |
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(¬ification_ui_manager_); | 118 ->SetNotificationUIManagerForTesting(¬ification_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 Loading... |
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 |
OLD | NEW |