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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/chromeos/device/input_service_proxy.h" | 9 #include "chrome/browser/chromeos/device/input_service_proxy.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(InputServiceLinuxTestImpl); | 35 DISALLOW_COPY_AND_ASSIGN(InputServiceLinuxTestImpl); |
36 }; | 36 }; |
37 | 37 |
38 class TestObserver : public InputServiceProxy::Observer { | 38 class TestObserver : public InputServiceProxy::Observer { |
39 public: | 39 public: |
40 TestObserver() | 40 TestObserver() |
41 : wait_for_device_addition_(false), wait_for_device_removal_(false) {} | 41 : wait_for_device_addition_(false), wait_for_device_removal_(false) {} |
42 virtual ~TestObserver() {} | 42 virtual ~TestObserver() {} |
43 | 43 |
44 virtual void OnInputDeviceAdded(const InputDeviceInfo& info) OVERRIDE { | 44 virtual void OnInputDeviceAdded(const InputDeviceInfo& info) override { |
45 if (!wait_for_device_addition_) | 45 if (!wait_for_device_addition_) |
46 return; | 46 return; |
47 EXPECT_TRUE(Equals(expected_info_, info)); | 47 EXPECT_TRUE(Equals(expected_info_, info)); |
48 done_.Run(); | 48 done_.Run(); |
49 } | 49 } |
50 | 50 |
51 virtual void OnInputDeviceRemoved(const std::string& id) OVERRIDE { | 51 virtual void OnInputDeviceRemoved(const std::string& id) override { |
52 if (!wait_for_device_removal_) | 52 if (!wait_for_device_removal_) |
53 return; | 53 return; |
54 EXPECT_EQ(expected_id_, id); | 54 EXPECT_EQ(expected_id_, id); |
55 done_.Run(); | 55 done_.Run(); |
56 } | 56 } |
57 | 57 |
58 void WaitForDeviceAddition(const InputDeviceInfo& info) { | 58 void WaitForDeviceAddition(const InputDeviceInfo& info) { |
59 base::RunLoop run; | 59 base::RunLoop run; |
60 expected_info_ = info; | 60 expected_info_ = info; |
61 wait_for_device_addition_ = true; | 61 wait_for_device_addition_ = true; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 { | 197 { |
198 base::RunLoop run; | 198 base::RunLoop run; |
199 proxy.GetDeviceInfo(kMouseId, base::Bind(&OnGetMouse, run.QuitClosure())); | 199 proxy.GetDeviceInfo(kMouseId, base::Bind(&OnGetMouse, run.QuitClosure())); |
200 run.Run(); | 200 run.Run(); |
201 } | 201 } |
202 | 202 |
203 proxy.RemoveObserver(&observer); | 203 proxy.RemoveObserver(&observer); |
204 } | 204 } |
205 | 205 |
206 } // namespace chromeos | 206 } // namespace chromeos |
OLD | NEW |