| 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 |
| 430 std::set<int> claimed_interfaces_; | 434 std::set<int> claimed_interfaces_; |
| 431 | 435 |
| 432 protected: | 436 protected: |
| 433 virtual ~MockUsbDevice() {} | 437 virtual ~MockUsbDevice() {} |
| 434 | 438 |
| 435 private: | 439 private: |
| 436 UsbConfigDescriptor config_desc_; | 440 UsbConfigDescriptor config_desc_; |
| 437 }; | 441 }; |
| 438 | 442 |
| 439 class MockUsbService : public UsbService { | 443 class MockUsbService : public UsbService { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 EXPECT_EQ(2, listener.invoked_); | 799 EXPECT_EQ(2, listener.invoked_); |
| 796 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 800 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 797 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 801 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
| 798 } | 802 } |
| 799 | 803 |
| 800 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 804 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 801 MockCountListenerForCheckingTraits listener(adb_bridge_); | 805 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 802 adb_bridge_->AddDeviceCountListener(&listener); | 806 adb_bridge_->AddDeviceCountListener(&listener); |
| 803 runner_->Run(); | 807 runner_->Run(); |
| 804 } | 808 } |
| OLD | NEW |