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

Side by Side Diff: services/ui/ws/test_utils.cc

Issue 2916823002: Move Mus into chrome's process when running with --mus.
Patch Set: Undo Screen TLS change, don't use Screen::GetScreen() in Mus. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/test_utils.h" 5 #include "services/ui/ws/test_utils.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "cc/output/copy_output_request.h" 11 #include "cc/output/copy_output_request.h"
12 #include "gpu/ipc/client/gpu_channel_host.h" 12 #include "gpu/ipc/client/gpu_channel_host.h"
13 #include "services/service_manager/public/interfaces/connector.mojom.h" 13 #include "services/service_manager/public/interfaces/connector.mojom.h"
14 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" 14 #include "services/ui/public/interfaces/cursor/cursor.mojom.h"
15 #include "services/ui/ws/display_binding.h" 15 #include "services/ui/ws/display_binding.h"
16 #include "services/ui/ws/display_creation_config.h" 16 #include "services/ui/ws/display_creation_config.h"
17 #include "services/ui/ws/display_manager.h" 17 #include "services/ui/ws/display_manager.h"
18 #include "services/ui/ws/frame_sink_manager_client_binding.h" 18 #include "services/ui/ws/frame_sink_manager_client_binding.h"
19 #include "services/ui/ws/gpu_host.h" 19 #include "services/ui/ws/gpu_host.h"
20 #include "services/ui/ws/threaded_image_cursors.h"
20 #include "services/ui/ws/window_manager_access_policy.h" 21 #include "services/ui/ws/window_manager_access_policy.h"
21 #include "services/ui/ws/window_manager_window_tree_factory.h" 22 #include "services/ui/ws/window_manager_window_tree_factory.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/base/cursor/cursor.h" 24 #include "ui/base/cursor/cursor.h"
24 #include "ui/gfx/geometry/dip_util.h" 25 #include "ui/gfx/geometry/dip_util.h"
25 26
26 namespace ui { 27 namespace ui {
27 namespace ws { 28 namespace ws {
28 namespace test { 29 namespace test {
29 namespace { 30 namespace {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 bool automatically_create_display_roots) { 540 bool automatically_create_display_roots) {
540 if (window_server_->display_creation_config() != 541 if (window_server_->display_creation_config() !=
541 DisplayCreationConfig::UNKNOWN) { 542 DisplayCreationConfig::UNKNOWN) {
542 return; 543 return;
543 } 544 }
544 window_server_->SetDisplayCreationConfig( 545 window_server_->SetDisplayCreationConfig(
545 automatically_create_display_roots ? DisplayCreationConfig::AUTOMATIC 546 automatically_create_display_roots ? DisplayCreationConfig::AUTOMATIC
546 : DisplayCreationConfig::MANUAL); 547 : DisplayCreationConfig::MANUAL);
547 } 548 }
548 549
550 scoped_refptr<base::SingleThreadTaskRunner>&
551 TestWindowServerDelegate::GetResourceRunner() {
552 return resource_runner_;
553 }
554
555 base::WeakPtr<ui::ImageCursors>
556 TestWindowServerDelegate::GetImageCursorsWeakPtr() {
557 if (!image_cursors_)
558 image_cursors_ = base::MakeUnique<ui::ImageCursors>();
559 return image_cursors_->GetWeakPtr();
560 }
561
549 // WindowServerTestHelper --------------------------------------------------- 562 // WindowServerTestHelper ---------------------------------------------------
550 563
551 WindowServerTestHelper::WindowServerTestHelper() 564 WindowServerTestHelper::WindowServerTestHelper()
552 : cursor_(ui::CursorType::kNull), platform_display_factory_(&cursor_) { 565 : cursor_(ui::CursorType::kNull), platform_display_factory_(&cursor_) {
553 // Some tests create their own message loop, for example to add a task runner. 566 // Some tests create their own message loop, for example to add a task runner.
554 if (!base::MessageLoop::current()) 567 if (!base::MessageLoop::current())
555 message_loop_ = base::MakeUnique<base::MessageLoop>(); 568 message_loop_ = base::MakeUnique<base::MessageLoop>();
556 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); 569 PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
557 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_); 570 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_);
558 // TODO(staraz): Replace DefaultGpuHost and FrameSinkManagerClientBinding with 571 // TODO(staraz): Replace DefaultGpuHost and FrameSinkManagerClientBinding with
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (!tree->AddWindow(parent_client_id, client_window_id)) 767 if (!tree->AddWindow(parent_client_id, client_window_id))
755 return nullptr; 768 return nullptr;
756 if (client_id) 769 if (client_id)
757 *client_id = client_window_id; 770 *client_id = client_window_id;
758 return tree->GetWindowByClientId(client_window_id); 771 return tree->GetWindowByClientId(client_window_id);
759 } 772 }
760 773
761 } // namespace test 774 } // namespace test
762 } // namespace ws 775 } // namespace ws
763 } // namespace ui 776 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698