| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 virtual bool GetSerialNumber(base::string16* serial) override { | 427 virtual bool GetSerialNumber(base::string16* serial) override { |
| 428 *serial = base::UTF8ToUTF16(kDeviceSerial); | 428 *serial = base::UTF8ToUTF16(kDeviceSerial); |
| 429 return true; | 429 return true; |
| 430 } | 430 } |
| 431 | 431 |
| 432 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) override { | 432 virtual bool Close(scoped_refptr<UsbDeviceHandle> handle) override { |
| 433 return true; | 433 return true; |
| 434 } | 434 } |
| 435 | 435 |
| 436 #if defined(OS_CHROMEOS) | |
| 437 // On ChromeOS, if an interface of a claimed device is not claimed, the | |
| 438 // permission broker can change the owner of the device so that the unclaimed | |
| 439 // interfaces can be used. If this argument is missing, permission broker will | |
| 440 // not be used and this method fails if the device is claimed. | |
| 441 virtual void RequestUsbAccess( | |
| 442 int interface_id, | |
| 443 const base::Callback<void(bool success)>& callback) override { | |
| 444 callback.Run(true); | |
| 445 } | |
| 446 #endif // OS_CHROMEOS | |
| 447 | |
| 448 std::set<int> claimed_interfaces_; | 436 std::set<int> claimed_interfaces_; |
| 449 | 437 |
| 450 protected: | 438 protected: |
| 451 virtual ~MockUsbDevice() {} | 439 virtual ~MockUsbDevice() {} |
| 452 | 440 |
| 453 private: | 441 private: |
| 454 UsbConfigDescriptor config_desc_; | 442 UsbConfigDescriptor config_desc_; |
| 455 }; | 443 }; |
| 456 | 444 |
| 457 class MockUsbService : public UsbService { | 445 class MockUsbService : public UsbService { |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 runner_->Run(); | 849 runner_->Run(); |
| 862 EXPECT_EQ(2, listener.invoked_); | 850 EXPECT_EQ(2, listener.invoked_); |
| 863 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 851 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 864 } | 852 } |
| 865 | 853 |
| 866 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 854 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 867 MockCountListenerForCheckingTraits listener(adb_bridge_); | 855 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 868 adb_bridge_->AddDeviceCountListener(&listener); | 856 adb_bridge_->AddDeviceCountListener(&listener); |
| 869 runner_->Run(); | 857 runner_->Run(); |
| 870 } | 858 } |
| OLD | NEW |