| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/containers/scoped_ptr_hash_map.h" | 7 #include "base/containers/scoped_ptr_hash_map.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 broken_ ? device::USB_TRANSFER_ERROR : device::USB_TRANSFER_COMPLETED; | 216 broken_ ? device::USB_TRANSFER_ERROR : device::USB_TRANSFER_COMPLETED; |
| 217 base::ThreadTaskRunnerHandle::Get()->PostTask( | 217 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 218 FROM_HERE, base::Bind(callback, status, nullptr, 0)); | 218 FROM_HERE, base::Bind(callback, status, nullptr, 0)); |
| 219 ProcessQueries(); | 219 ProcessQueries(); |
| 220 } else if (direction == device::USB_DIRECTION_INBOUND) { | 220 } else if (direction == device::USB_DIRECTION_INBOUND) { |
| 221 queries_.push(Query(callback, buffer, length)); | 221 queries_.push(Query(callback, buffer, length)); |
| 222 ProcessQueries(); | 222 ProcessQueries(); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool FindInterfaceByEndpoint(uint8_t endpoint_address, |
| 227 uint8_t* interface_number) { |
| 228 NOTIMPLEMENTED(); |
| 229 return false; |
| 230 } |
| 231 |
| 226 template <class D> | 232 template <class D> |
| 227 void append(D data) { | 233 void append(D data) { |
| 228 std::copy(reinterpret_cast<char*>(&data), | 234 std::copy(reinterpret_cast<char*>(&data), |
| 229 (reinterpret_cast<char*>(&data)) + sizeof(D), | 235 (reinterpret_cast<char*>(&data)) + sizeof(D), |
| 230 std::back_inserter(output_buffer_)); | 236 std::back_inserter(output_buffer_)); |
| 231 } | 237 } |
| 232 | 238 |
| 233 // Copied from AndroidUsbDevice::Checksum | 239 // Copied from AndroidUsbDevice::Checksum |
| 234 uint32 Checksum(const std::string& data) { | 240 uint32 Checksum(const std::string& data) { |
| 235 unsigned char* x = (unsigned char*)data.data(); | 241 unsigned char* x = (unsigned char*)data.data(); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 EXPECT_EQ(2, listener.invoked_); | 796 EXPECT_EQ(2, listener.invoked_); |
| 791 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 797 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 792 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 798 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 793 } | 799 } |
| 794 | 800 |
| 795 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 801 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 796 MockCountListenerForCheckingTraits listener(adb_bridge_); | 802 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 797 adb_bridge_->AddDeviceCountListener(&listener); | 803 adb_bridge_->AddDeviceCountListener(&listener); |
| 798 runner_->Run(); | 804 runner_->Run(); |
| 799 } | 805 } |
| OLD | NEW |