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

Side by Side Diff: ui/events/test/device_data_manager_test_api.cc

Issue 1182303005: Fixed the Touchscreen.TouchEventsEnabled histogram to record the correct values on X11 and Ozone ba… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed asvitkine@'s comments from patch set 11. Created 5 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/events/test/device_data_manager_test_api.h"
6
7 #define DEVICE_DATA_MANAGER_IS_AVAILABLE \
8 (defined(USE_OZONE) || defined(USE_X11))
9
10 #if DEVICE_DATA_MANAGER_IS_AVAILABLE
11 #include "ui/events/devices/device_data_manager.h"
12 #endif // DEVICE_DATA_MANAGER_IS_AVAILABLE
13
14 namespace ui {
15 namespace test {
16
17 DeviceDataManagerTestAPI::DeviceDataManagerTestAPI() {
18 }
19
20 DeviceDataManagerTestAPI::~DeviceDataManagerTestAPI() {
21 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
22 NOTREACHED();
23 #else
24 if (DeviceDataManager::instance() == device_data_manager_.get())
25 DeviceDataManager::set_instance(nullptr);
26 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
27 }
28
29 bool DeviceDataManagerTestAPI::CreateDeviceDataManagerInstance() {
30 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
31 return false;
32 #else
33 if (DeviceDataManager::instance())
34 DeviceDataManager::set_instance(nullptr);
35
36 device_data_manager_.reset(new DeviceDataManager());
37 DeviceDataManager::set_instance(device_data_manager_.get());
38
39 return true;
40 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
41 }
42
43 void DeviceDataManagerTestAPI::
44 NotifyObserversTouchscreenDeviceConfigurationChanged() {
45 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
46 NOTREACHED();
47 #else
48 device_data_manager_->NotifyObserversTouchscreenDeviceConfigurationChanged();
49 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
50 }
51
52 void DeviceDataManagerTestAPI::
53 NotifyObserversKeyboardDeviceConfigurationChanged() {
54 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
55 NOTREACHED();
56 #else
57 device_data_manager_->NotifyObserversKeyboardDeviceConfigurationChanged();
58 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
59 }
60
61 void DeviceDataManagerTestAPI::
62 NotifyObserversMouseDeviceConfigurationChanged() {
63 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
64 NOTREACHED();
65 #else
66 device_data_manager_->NotifyObserversMouseDeviceConfigurationChanged();
67 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
68 }
69
70 void DeviceDataManagerTestAPI::
71 NotifyObserversTouchpadDeviceConfigurationChanged() {
72 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
73 NOTREACHED();
74 #else
75 device_data_manager_->NotifyObserversTouchpadDeviceConfigurationChanged();
76 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
77 }
78
79 void DeviceDataManagerTestAPI::NotifyObserversDeviceListsComplete() {
80 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
81 NOTREACHED();
82 #else
83 device_data_manager_->NotifyObserversDeviceListsComplete();
84 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
85 }
86
87 void DeviceDataManagerTestAPI::OnDeviceListsComplete() {
88 #if !DEVICE_DATA_MANAGER_IS_AVAILABLE
89 NOTREACHED();
90 #else
91 device_data_manager_->OnDeviceListsComplete();
92 #endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
93 }
94
sadrul 2015/07/10 17:35:48 Split this into two files: device_data_manager_tes
bruthig 2015/07/10 20:04:58 Done.
95 } // namespace test
96 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698