Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: services/ui/input_devices/input_device_server.cc

Issue 2196563004: Add tests for InputDeviceServer/InputDeviceClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch test runner. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/input_devices/BUILD.gn ('k') | services/ui/input_devices/input_device_unittests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/input_devices/input_device_server.h" 5 #include "services/ui/input_devices/input_device_server.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "mojo/public/cpp/bindings/array.h" 10 #include "mojo/public/cpp/bindings/array.h"
(...skipping 16 matching lines...) Expand all
27 manager_ = ui::DeviceDataManager::GetInstance(); 27 manager_ = ui::DeviceDataManager::GetInstance();
28 manager_->AddObserver(this); 28 manager_->AddObserver(this);
29 } 29 }
30 } 30 }
31 31
32 bool InputDeviceServer::IsRegisteredAsObserver() const { 32 bool InputDeviceServer::IsRegisteredAsObserver() const {
33 return manager_ != nullptr; 33 return manager_ != nullptr;
34 } 34 }
35 35
36 void InputDeviceServer::AddInterface(shell::Connection* connection) { 36 void InputDeviceServer::AddInterface(shell::Connection* connection) {
37 DCHECK(manager_); 37 DCHECK(IsRegisteredAsObserver());
38 connection->AddInterface<mojom::InputDeviceServer>(this); 38 connection->AddInterface<mojom::InputDeviceServer>(this);
39 } 39 }
40 40
41 void InputDeviceServer::AddObserver( 41 void InputDeviceServer::AddObserver(
42 mojom::InputDeviceObserverMojoPtr observer) { 42 mojom::InputDeviceObserverMojoPtr observer) {
43 // We only want to send this message once, so we need to check to make sure 43 // We only want to send this message once, so we need to check to make sure
44 // device lists are actually complete before sending it to a new observer. 44 // device lists are actually complete before sending it to a new observer.
45 if (manager_->AreDeviceListsComplete()) 45 if (manager_->AreDeviceListsComplete())
46 SendDeviceListsComplete(observer.get()); 46 SendDeviceListsComplete(observer.get());
47 observers_.AddPtr(std::move(observer)); 47 observers_.AddPtr(std::move(observer));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(), 101 manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(),
102 manager_->GetMouseDevices(), manager_->GetTouchpadDevices()); 102 manager_->GetMouseDevices(), manager_->GetTouchpadDevices());
103 } 103 }
104 104
105 void InputDeviceServer::Create(const shell::Identity& remote_identity, 105 void InputDeviceServer::Create(const shell::Identity& remote_identity,
106 mojom::InputDeviceServerRequest request) { 106 mojom::InputDeviceServerRequest request) {
107 bindings_.AddBinding(this, std::move(request)); 107 bindings_.AddBinding(this, std::move(request));
108 } 108 }
109 109
110 } // namespace ui 110 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/input_devices/BUILD.gn ('k') | services/ui/input_devices/input_device_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698