Chromium Code Reviews| Index: ui/events/test/device_data_manager_test_api.h |
| diff --git a/ui/events/test/device_data_manager_test_api.h b/ui/events/test/device_data_manager_test_api.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..557ded4918b71b437eae8566ec3647dc36c0472a |
| --- /dev/null |
| +++ b/ui/events/test/device_data_manager_test_api.h |
| @@ -0,0 +1,60 @@ |
| +// 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. |
| + |
| +#ifndef UI_EVENTS_TEST_DEVICE_DATA_MANAGER_TEST_API_H_ |
| +#define UI_EVENTS_TEST_DEVICE_DATA_MANAGER_TEST_API_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/events/devices/events_devices_export.h" |
| + |
| +namespace ui { |
| + |
| +class DeviceDataManager; |
| + |
| +namespace test { |
| + |
| +// Test API class to access internals of the DeviceDataManager class. |
| +class DeviceDataManagerTestAPI { |
| + public: |
| + // Constructs a test api that provides access to the global DeviceDataManager |
| + // instance that accessible by DeviceDataManager::GetInstance(). If |
| + // |delete_instance| is true then DeviceDataManager::DeleteInstance() will be |
| + // called during the destructor. |
| + explicit DeviceDataManagerTestAPI(bool delete_instance); |
| + |
| + // Will call DeviceDataManager::DeleteInstance() if |delete_instance_| is |
| + // true. |
| + ~DeviceDataManagerTestAPI(); |
| + |
| + // Creates a new ui::DeviceDataManager and sets it as the global instance. |
| + // i.e. It is accessible via ui::DeviceDataManager::GetInstance(). If the |
| + // DeviceDataManager already owns an instance it will be deleted using |
| + // DeviceDataManager::DeleteInstance(). |
| + // |
| + // Note: The ui::DeviceDataManager is not available on all platforms, thus |
| + // this returns true when it is possible to instantiate a |
| + // ui::DeviceDataManager instance and false otherwise. |
| + bool CreateDeviceDataManagerInstance(); |
|
sadrul
2015/07/10 21:57:34
Why does delete_instance need to be passed-in to t
bruthig
2015/07/10 22:27:28
Done.
|
| + |
| + // Wrapper functions to DeviceDataManager. |
| + void NotifyObserversTouchscreenDeviceConfigurationChanged(); |
| + void NotifyObserversKeyboardDeviceConfigurationChanged(); |
| + void NotifyObserversMouseDeviceConfigurationChanged(); |
| + void NotifyObserversTouchpadDeviceConfigurationChanged(); |
| + void NotifyObserversDeviceListsComplete(); |
| + void OnDeviceListsComplete(); |
| + |
| + private: |
| + // Tracks whether DeviceDataManager::DeleteInstance() should be called during |
| + // destruction. |
| + bool delete_instance_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerTestAPI); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace ui |
| + |
| +#endif // UI_EVENTS_TEST_DEVICE_DATA_MANAGER_TEST_API_H_ |