| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  634  public: |  634  public: | 
|  635   explicit MockCountListener(DevToolsAndroidBridge* adb_bridge) |  635   explicit MockCountListener(DevToolsAndroidBridge* adb_bridge) | 
|  636       : adb_bridge_(adb_bridge), invoked_(0) {} |  636       : adb_bridge_(adb_bridge), invoked_(0) {} | 
|  637  |  637  | 
|  638   void DeviceCountChanged(int count) override { |  638   void DeviceCountChanged(int count) override { | 
|  639     ++invoked_; |  639     ++invoked_; | 
|  640     adb_bridge_->RemoveDeviceCountListener(this); |  640     adb_bridge_->RemoveDeviceCountListener(this); | 
|  641     Shutdown(); |  641     Shutdown(); | 
|  642   } |  642   } | 
|  643  |  643  | 
|  644   void Shutdown() { base::MessageLoop::current()->Quit(); } |  644   void Shutdown() { base::MessageLoop::current()->QuitWhenIdle(); } | 
|  645  |  645  | 
|  646   DevToolsAndroidBridge* adb_bridge_; |  646   DevToolsAndroidBridge* adb_bridge_; | 
|  647   int invoked_; |  647   int invoked_; | 
|  648 }; |  648 }; | 
|  649  |  649  | 
|  650 class MockCountListenerWithReAdd : public MockCountListener { |  650 class MockCountListenerWithReAdd : public MockCountListener { | 
|  651  public: |  651  public: | 
|  652   explicit MockCountListenerWithReAdd( |  652   explicit MockCountListenerWithReAdd( | 
|  653       DevToolsAndroidBridge* adb_bridge) |  653       DevToolsAndroidBridge* adb_bridge) | 
|  654       : MockCountListener(adb_bridge), |  654       : MockCountListener(adb_bridge), | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  796   EXPECT_EQ(2, listener.invoked_); |  796   EXPECT_EQ(2, listener.invoked_); | 
|  797   EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); |  797   EXPECT_EQ(listener.invoked_ - 1, scheduler_invoked_); | 
|  798   EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); |  798   EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); | 
|  799 } |  799 } | 
|  800  |  800  | 
|  801 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { |  801 IN_PROC_BROWSER_TEST_F(AndroidUsbTraitsTest, TestDeviceCounting) { | 
|  802   MockCountListenerForCheckingTraits listener(adb_bridge_); |  802   MockCountListenerForCheckingTraits listener(adb_bridge_); | 
|  803   adb_bridge_->AddDeviceCountListener(&listener); |  803   adb_bridge_->AddDeviceCountListener(&listener); | 
|  804   runner_->Run(); |  804   runner_->Run(); | 
|  805 } |  805 } | 
| OLD | NEW |