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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/test/device_data_manager_test_api.cc
diff --git a/ui/events/test/device_data_manager_test_api.cc b/ui/events/test/device_data_manager_test_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..200a03a2d71eb38e0f210e793a1baa83c4e413ef
--- /dev/null
+++ b/ui/events/test/device_data_manager_test_api.cc
@@ -0,0 +1,96 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/test/device_data_manager_test_api.h"
+
+#define DEVICE_DATA_MANAGER_IS_AVAILABLE \
+ (defined(USE_OZONE) || defined(USE_X11))
+
+#if DEVICE_DATA_MANAGER_IS_AVAILABLE
+#include "ui/events/devices/device_data_manager.h"
+#endif // DEVICE_DATA_MANAGER_IS_AVAILABLE
+
+namespace ui {
+namespace test {
+
+DeviceDataManagerTestAPI::DeviceDataManagerTestAPI() {
+}
+
+DeviceDataManagerTestAPI::~DeviceDataManagerTestAPI() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ if (DeviceDataManager::instance() == device_data_manager_.get())
+ DeviceDataManager::set_instance(nullptr);
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+bool DeviceDataManagerTestAPI::CreateDeviceDataManagerInstance() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ return false;
+#else
+ if (DeviceDataManager::instance())
+ DeviceDataManager::set_instance(nullptr);
+
+ device_data_manager_.reset(new DeviceDataManager());
+ DeviceDataManager::set_instance(device_data_manager_.get());
+
+ return true;
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::
+ NotifyObserversTouchscreenDeviceConfigurationChanged() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->NotifyObserversTouchscreenDeviceConfigurationChanged();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::
+ NotifyObserversKeyboardDeviceConfigurationChanged() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->NotifyObserversKeyboardDeviceConfigurationChanged();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::
+ NotifyObserversMouseDeviceConfigurationChanged() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->NotifyObserversMouseDeviceConfigurationChanged();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::
+ NotifyObserversTouchpadDeviceConfigurationChanged() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->NotifyObserversTouchpadDeviceConfigurationChanged();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::NotifyObserversDeviceListsComplete() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->NotifyObserversDeviceListsComplete();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
+void DeviceDataManagerTestAPI::OnDeviceListsComplete() {
+#if !DEVICE_DATA_MANAGER_IS_AVAILABLE
+ NOTREACHED();
+#else
+ device_data_manager_->OnDeviceListsComplete();
+#endif // !DEVICE_DATA_MANAGER_IS_AVAILABLE
+}
+
sadrul 2015/07/10 17:35:48 Split this into two files: device_data_manager_tes
bruthig 2015/07/10 20:04:58 Done.
+} // namespace test
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698