Index: services/ui/ws/test_utils.cc |
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc |
index 8d9bafa96b46972992130c22f5a3597f81de7ad9..ba7a3d86ed499bdbccd765a8995b71569c96406b 100644 |
--- a/services/ui/ws/test_utils.cc |
+++ b/services/ui/ws/test_utils.cc |
@@ -11,12 +11,15 @@ |
#include "cc/output/copy_output_request.h" |
#include "gpu/ipc/client/gpu_channel_host.h" |
#include "services/service_manager/public/interfaces/connector.mojom.h" |
+#include "services/ui/common/image_cursors_set.h" |
#include "services/ui/public/interfaces/cursor/cursor.mojom.h" |
#include "services/ui/ws/display_binding.h" |
#include "services/ui/ws/display_creation_config.h" |
#include "services/ui/ws/display_manager.h" |
#include "services/ui/ws/frame_sink_manager_client_binding.h" |
#include "services/ui/ws/gpu_host.h" |
+#include "services/ui/ws/threaded_image_cursors.h" |
+#include "services/ui/ws/threaded_image_cursors_factory.h" |
#include "services/ui/ws/window_manager_access_policy.h" |
#include "services/ui/ws/window_manager_window_tree_factory.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -89,6 +92,28 @@ display::ViewportMetrics MakeViewportMetrics(const display::Display& display) { |
return metrics; |
} |
+class TestThreadedImageCursorsFactory : public ThreadedImageCursorsFactory { |
+ public: |
+ TestThreadedImageCursorsFactory() {} |
+ ~TestThreadedImageCursorsFactory() override {} |
+ |
+ // ThreadedImageCursorsFactory: |
+ std::unique_ptr<ThreadedImageCursors> CreateCursors() override { |
+ if (!resource_runner_) { |
+ resource_runner_ = base::ThreadTaskRunnerHandle::Get(); |
+ image_cursors_set_ = base::MakeUnique<ui::ImageCursorsSet>(); |
+ } |
+ return base::MakeUnique<ws::ThreadedImageCursors>( |
+ resource_runner_, image_cursors_set_->GetWeakPtr()); |
+ } |
+ |
+ private: |
+ scoped_refptr<base::SingleThreadTaskRunner> resource_runner_; |
+ std::unique_ptr<ui::ImageCursorsSet> image_cursors_set_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestThreadedImageCursorsFactory); |
+}; |
+ |
} // namespace |
// TestScreenManager ------------------------------------------------- |
@@ -509,7 +534,9 @@ mojom::WindowTreeClient* TestWindowTreeBinding::CreateClientForShutdown() { |
// TestWindowServerDelegate ---------------------------------------------- |
-TestWindowServerDelegate::TestWindowServerDelegate() {} |
+TestWindowServerDelegate::TestWindowServerDelegate() |
+ : threaded_image_cursors_factory_( |
+ base::MakeUnique<TestThreadedImageCursorsFactory>()) {} |
TestWindowServerDelegate::~TestWindowServerDelegate() {} |
void TestWindowServerDelegate::StartDisplayInit() {} |
@@ -546,6 +573,11 @@ void TestWindowServerDelegate::OnWillCreateTreeForWindowManager( |
: DisplayCreationConfig::MANUAL); |
} |
+ThreadedImageCursorsFactory* |
+TestWindowServerDelegate::GetThreadedImageCursorsFactory() { |
+ return threaded_image_cursors_factory_.get(); |
+} |
+ |
// WindowServerTestHelper --------------------------------------------------- |
WindowServerTestHelper::WindowServerTestHelper() |