| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 std::queue<Query> queries_; | 389 std::queue<Query> queries_; |
| 390 base::ScopedPtrHashMap<int, scoped_ptr<MockLocalSocket>> local_sockets_; | 390 base::ScopedPtrHashMap<int, scoped_ptr<MockLocalSocket>> local_sockets_; |
| 391 int last_local_socket_; | 391 int last_local_socket_; |
| 392 bool broken_; | 392 bool broken_; |
| 393 }; | 393 }; |
| 394 | 394 |
| 395 template <class T> | 395 template <class T> |
| 396 class MockUsbDevice : public UsbDevice { | 396 class MockUsbDevice : public UsbDevice { |
| 397 public: | 397 public: |
| 398 MockUsbDevice() | 398 MockUsbDevice() |
| 399 : UsbDevice(0, | 399 : UsbDevice(0x0200, // usb_version |
| 400 0, | 400 0, // device_class |
| 401 0, // device_subclass |
| 402 0, // device_protocol |
| 403 0, // vendor_id |
| 404 0, // product_id |
| 405 0x0100, // device_version |
| 401 base::UTF8ToUTF16(kDeviceManufacturer), | 406 base::UTF8ToUTF16(kDeviceManufacturer), |
| 402 base::UTF8ToUTF16(kDeviceModel), | 407 base::UTF8ToUTF16(kDeviceModel), |
| 403 base::UTF8ToUTF16(kDeviceSerial)), | 408 base::UTF8ToUTF16(kDeviceSerial)), |
| 404 config_desc_(1, false, false, 0) { | 409 config_desc_(1, false, false, 0) { |
| 405 UsbInterfaceDescriptor interface_desc(0, 0, T::kClass, T::kSubclass, | 410 UsbInterfaceDescriptor interface_desc(0, 0, T::kClass, T::kSubclass, |
| 406 T::kProtocol); | 411 T::kProtocol); |
| 407 interface_desc.endpoints.emplace_back(0x81, device::USB_DIRECTION_INBOUND, | 412 interface_desc.endpoints.emplace_back(0x81, device::USB_DIRECTION_INBOUND, |
| 408 512, device::USB_SYNCHRONIZATION_NONE, | 413 512, device::USB_SYNCHRONIZATION_NONE, |
| 409 device::USB_TRANSFER_BULK, | 414 device::USB_TRANSFER_BULK, |
| 410 device::USB_USAGE_DATA, 0); | 415 device::USB_USAGE_DATA, 0); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 EXPECT_EQ(2, listener.invoked_); | 798 EXPECT_EQ(2, listener.invoked_); |
| 794 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 799 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 795 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 800 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 796 } | 801 } |
| 797 | 802 |
| 798 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 803 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 799 MockCountListenerForCheckingTraits listener(adb_bridge_); | 804 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 800 adb_bridge_->AddDeviceCountListener(&listener); | 805 adb_bridge_->AddDeviceCountListener(&listener); |
| 801 runner_->Run(); | 806 runner_->Run(); |
| 802 } | 807 } |
| OLD | NEW |