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

Unified Diff: services/ui/ws/test_utils.cc

Issue 2916823002: Move Mus into chrome's process when running with --mus.
Patch Set: Removing debug include. Created 3 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
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/threaded_image_cursors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « services/ui/ws/test_utils.h ('k') | services/ui/ws/threaded_image_cursors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698