| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 device::USB_USAGE_DATA, 0); | 414 device::USB_USAGE_DATA, 0); |
| 415 config_desc_.interfaces.push_back(interface_desc); | 415 config_desc_.interfaces.push_back(interface_desc); |
| 416 } | 416 } |
| 417 | 417 |
| 418 void Open(const OpenCallback& callback) override { | 418 void Open(const OpenCallback& callback) override { |
| 419 base::ThreadTaskRunnerHandle::Get()->PostTask( | 419 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 420 FROM_HERE, base::Bind(callback, make_scoped_refptr( | 420 FROM_HERE, base::Bind(callback, make_scoped_refptr( |
| 421 new MockUsbDeviceHandle<T>(this)))); | 421 new MockUsbDeviceHandle<T>(this)))); |
| 422 } | 422 } |
| 423 | 423 |
| 424 const UsbConfigDescriptor* GetActiveConfiguration() override { | 424 const UsbConfigDescriptor* GetActiveConfiguration() const override { |
| 425 return T::kConfigured ? &config_desc_ : nullptr; | 425 return T::kConfigured ? &config_desc_ : nullptr; |
| 426 } | 426 } |
| 427 | 427 |
| 428 std::set<int> claimed_interfaces_; | 428 std::set<int> claimed_interfaces_; |
| 429 | 429 |
| 430 protected: | 430 protected: |
| 431 virtual ~MockUsbDevice() {} | 431 virtual ~MockUsbDevice() {} |
| 432 | 432 |
| 433 private: | 433 private: |
| 434 UsbConfigDescriptor config_desc_; | 434 UsbConfigDescriptor config_desc_; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 EXPECT_EQ(2, listener.invoked_); | 793 EXPECT_EQ(2, listener.invoked_); |
| 794 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 794 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 795 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 795 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 796 } | 796 } |
| 797 | 797 |
| 798 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 798 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 799 MockCountListenerForCheckingTraits listener(adb_bridge_); | 799 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 800 adb_bridge_->AddDeviceCountListener(&listener); | 800 adb_bridge_->AddDeviceCountListener(&listener); |
| 801 runner_->Run(); | 801 runner_->Run(); |
| 802 } | 802 } |
| OLD | NEW |