| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 void DeviceListChanged( | 623 void DeviceListChanged( |
| 624 const DevToolsAndroidBridge::RemoteDevices& devices) override { | 624 const DevToolsAndroidBridge::RemoteDevices& devices) override { |
| 625 if (devices.size() > 0) { | 625 if (devices.size() > 0) { |
| 626 for (const auto& device : devices) { | 626 for (const auto& device : devices) { |
| 627 if (device->is_connected()) { | 627 if (device->is_connected()) { |
| 628 ASSERT_EQ(kDeviceModel, device->model()); | 628 ASSERT_EQ(kDeviceModel, device->model()); |
| 629 ASSERT_EQ(kDeviceSerial, device->serial()); | 629 ASSERT_EQ(kDeviceSerial, device->serial()); |
| 630 adb_bridge_->RemoveDeviceListListener(this); | 630 adb_bridge_->RemoveDeviceListListener(this); |
| 631 callback_.Run(); | 631 callback_.Run(); |
| 632 break; |
| 632 } | 633 } |
| 633 } | 634 } |
| 634 } | 635 } |
| 635 } | 636 } |
| 636 | 637 |
| 637 DevToolsAndroidBridge* adb_bridge_; | 638 DevToolsAndroidBridge* adb_bridge_; |
| 638 base::Closure callback_; | 639 base::Closure callback_; |
| 639 }; | 640 }; |
| 640 | 641 |
| 641 class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener { | 642 class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 runner_->Run(); | 823 runner_->Run(); |
| 823 EXPECT_EQ(2, listener.invoked_); | 824 EXPECT_EQ(2, listener.invoked_); |
| 824 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 825 EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |
| 825 } | 826 } |
| 826 | 827 |
| 827 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 828 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |
| 828 MockCountListenerForCheckingTraits listener(adb_bridge_); | 829 MockCountListenerForCheckingTraits listener(adb_bridge_); |
| 829 adb_bridge_->AddDeviceCountListener(&listener); | 830 adb_bridge_->AddDeviceCountListener(&listener); |
| 830 runner_->Run(); | 831 runner_->Run(); |
| 831 } | 832 } |
| OLD | NEW |