| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 8 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
| 9 #include "chrome/browser/devtools/device/usb/android_usb_device.h" | 9 #include "chrome/browser/devtools/device/usb/android_usb_device.h" |
| 10 #include "chrome/browser/devtools/device/usb/usb_device_provider.h" | 10 #include "chrome/browser/devtools/device/usb/usb_device_provider.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) OVERRIDE { | 458 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) OVERRIDE { |
| 459 return true; | 459 return true; |
| 460 } | 460 } |
| 461 | 461 |
| 462 #if defined(OS_CHROMEOS) | 462 #if defined(OS_CHROMEOS) |
| 463 // On ChromeOS, if an interface of a claimed device is not claimed, the | 463 // On ChromeOS, if an interface of a claimed device is not claimed, the |
| 464 // permission broker can change the owner of the device so that the unclaimed | 464 // permission broker can change the owner of the device so that the unclaimed |
| 465 // interfaces can be used. If this argument is missing, permission broker will | 465 // interfaces can be used. If this argument is missing, permission broker will |
| 466 // not be used and this method fails if the device is claimed. | 466 // not be used and this method fails if the device is claimed. |
| 467 virtual void RequestUsbAcess( | 467 virtual void RequestUsbAccess( |
| 468 int interface_id, | 468 int interface_id, |
| 469 const base::Callback<void(bool success)>& callback) OVERRIDE { | 469 const base::Callback<void(bool success)>& callback) OVERRIDE { |
| 470 callback.Run(true); | 470 callback.Run(true); |
| 471 } | 471 } |
| 472 #endif // OS_CHROMEOS | 472 #endif // OS_CHROMEOS |
| 473 | 473 |
| 474 std::set<int> claimed_interfaces_; | 474 std::set<int> claimed_interfaces_; |
| 475 | 475 |
| 476 protected: | 476 protected: |
| 477 virtual ~MockUsbDevice() {} | 477 virtual ~MockUsbDevice() {} |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 runner_->Run(); | 834 runner_->Run(); |
| 835 EXPECT_EQ(2, listener.invoked_); | 835 EXPECT_EQ(2, listener.invoked_); |
| 836 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 836 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 837 } | 837 } |
| 838 | 838 |
| 839 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 839 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 840 MockCountListenerForCheckingTraits listener(adb_bridge_); | 840 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 841 adb_bridge_->AddDeviceCountListener(&listener); | 841 adb_bridge_->AddDeviceCountListener(&listener); |
| 842 runner_->Run(); | 842 runner_->Run(); |
| 843 } | 843 } |
| OLD | NEW |