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..e31d543359dd7dc43208420d49d2f902bebdac52 |
--- /dev/null |
+++ b/ui/events/test/device_data_manager_test_api.cc |
@@ -0,0 +1,97 @@ |
+// 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() \ |
Alexei Svitkine (slow)
2015/07/09 15:17:05
Nit: I would define this without ()'s. I think ()'
bruthig
2015/07/10 15:38:42
Done.
|
+ (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; |
+ |
Alexei Svitkine (slow)
2015/07/09 15:17:05
Nit: Remove empty line.
bruthig
2015/07/10 15:38:42
Done.
|
+#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() |
+} |
+ |
+} // namespace test |
+} // namespace ui |