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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" | 9 #include "chrome/browser/devtools/device/adb/mock_adb_server.h" |
10 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 10 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 template <class T> | 113 template <class T> |
114 class MockUsbDeviceHandle : public UsbDeviceHandle { | 114 class MockUsbDeviceHandle : public UsbDeviceHandle { |
115 public: | 115 public: |
116 explicit MockUsbDeviceHandle(MockUsbDevice<T>* device) | 116 explicit MockUsbDeviceHandle(MockUsbDevice<T>* device) |
117 : device_(device), | 117 : device_(device), |
118 remaining_body_length_(0), | 118 remaining_body_length_(0), |
119 last_local_socket_(0), | 119 last_local_socket_(0), |
120 broken_(false) { | 120 broken_(false) { |
121 } | 121 } |
122 | 122 |
123 virtual scoped_refptr<UsbDevice> GetDevice() const override { | 123 scoped_refptr<UsbDevice> GetDevice() const override { |
124 return device_; | 124 return device_; |
125 } | 125 } |
126 | 126 |
127 virtual void Close() override { device_ = nullptr; } | 127 void Close() override { device_ = nullptr; } |
128 | 128 |
129 void SetConfiguration(int configuration_value, | 129 void SetConfiguration(int configuration_value, |
130 const ResultCallback& callback) override { | 130 const ResultCallback& callback) override { |
131 NOTIMPLEMENTED(); | 131 NOTIMPLEMENTED(); |
132 } | 132 } |
133 | 133 |
134 void ClaimInterface(int interface_number, | 134 void ClaimInterface(int interface_number, |
135 const ResultCallback& callback) override { | 135 const ResultCallback& callback) override { |
136 bool success = false; | 136 bool success = false; |
137 if (device_->claimed_interfaces_.find(interface_number) == | 137 if (device_->claimed_interfaces_.find(interface_number) == |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 EXPECT_EQ(2, listener.invoked_); | 783 EXPECT_EQ(2, listener.invoked_); |
784 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 784 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
785 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 785 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |
786 } | 786 } |
787 | 787 |
788 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 788 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
789 MockCountListenerForCheckingTraits listener(adb_bridge_); | 789 MockCountListenerForCheckingTraits listener(adb_bridge_); |
790 adb_bridge_->AddDeviceCountListener(&listener); | 790 adb_bridge_->AddDeviceCountListener(&listener); |
791 runner_->Run(); | 791 runner_->Run(); |
792 } | 792 } |
OLD | NEW |