| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 void Open(const OpenCallback& callback) override { | 420 void Open(const OpenCallback& callback) override { |
| 421 base::ThreadTaskRunnerHandle::Get()->PostTask( | 421 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 422 FROM_HERE, base::Bind(callback, make_scoped_refptr( | 422 FROM_HERE, base::Bind(callback, make_scoped_refptr( |
| 423 new MockUsbDeviceHandle<T>(this)))); | 423 new MockUsbDeviceHandle<T>(this)))); |
| 424 } | 424 } |
| 425 | 425 |
| 426 const UsbConfigDescriptor* GetActiveConfiguration() override { | 426 const UsbConfigDescriptor* GetActiveConfiguration() override { |
| 427 return T::kConfigured ? &config_desc_ : nullptr; | 427 return T::kConfigured ? &config_desc_ : nullptr; |
| 428 } | 428 } |
| 429 | 429 |
| 430 bool Close(scoped_refptr<UsbDeviceHandle> handle) override { | |
| 431 return true; | |
| 432 } | |
| 433 | |
| 434 std::set<int> claimed_interfaces_; | 430 std::set<int> claimed_interfaces_; |
| 435 | 431 |
| 436 protected: | 432 protected: |
| 437 virtual ~MockUsbDevice() {} | 433 virtual ~MockUsbDevice() {} |
| 438 | 434 |
| 439 private: | 435 private: |
| 440 UsbConfigDescriptor config_desc_; | 436 UsbConfigDescriptor config_desc_; |
| 441 }; | 437 }; |
| 442 | 438 |
| 443 class MockUsbService : public UsbService { | 439 class MockUsbService : public UsbService { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 EXPECT_EQ(2, listener.invoked_); | 795 EXPECT_EQ(2, listener.invoked_); |
| 800 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 796 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 801 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 797 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 802 } | 798 } |
| 803 | 799 |
| 804 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 800 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 805 MockCountListenerForCheckingTraits listener(adb_bridge_); | 801 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 806 adb_bridge_->AddDeviceCountListener(&listener); | 802 adb_bridge_->AddDeviceCountListener(&listener); |
| 807 runner_->Run(); | 803 runner_->Run(); |
| 808 } | 804 } |
| OLD | NEW |