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