OLD | NEW |
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 "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
11 #include "gpu/ipc/client/gpu_channel_host.h" | 11 #include "gpu/ipc/client/gpu_channel_host.h" |
12 #include "services/service_manager/public/interfaces/connector.mojom.h" | 12 #include "services/service_manager/public/interfaces/connector.mojom.h" |
13 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" | 13 #include "services/ui/public/interfaces/cursor/cursor.mojom.h" |
14 #include "services/ui/ws/display_binding.h" | 14 #include "services/ui/ws/display_binding.h" |
15 #include "services/ui/ws/display_manager.h" | 15 #include "services/ui/ws/display_manager.h" |
16 #include "services/ui/ws/window_manager_access_policy.h" | 16 #include "services/ui/ws/window_manager_access_policy.h" |
17 #include "services/ui/ws/window_manager_window_tree_factory.h" | 17 #include "services/ui/ws/window_manager_window_tree_factory.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/display/screen_base.h" |
19 #include "ui/gfx/geometry/dip_util.h" | 20 #include "ui/gfx/geometry/dip_util.h" |
20 | 21 |
21 namespace ui { | 22 namespace ui { |
22 namespace ws { | 23 namespace ws { |
23 namespace test { | 24 namespace test { |
24 namespace { | 25 namespace { |
25 | 26 |
26 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
27 // Empty implementation of PlatformDisplay. | 28 // Empty implementation of PlatformDisplay. |
28 class TestPlatformDisplay : public PlatformDisplay { | 29 class TestPlatformDisplay : public PlatformDisplay { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 std::unique_ptr<TestWindowTreeBinding> binding = | 517 std::unique_ptr<TestWindowTreeBinding> binding = |
517 base::MakeUnique<TestWindowTreeBinding>(tree); | 518 base::MakeUnique<TestWindowTreeBinding>(tree); |
518 bindings_.push_back(binding.get()); | 519 bindings_.push_back(binding.get()); |
519 return std::move(binding); | 520 return std::move(binding); |
520 } | 521 } |
521 | 522 |
522 bool TestWindowServerDelegate::IsTestConfig() const { | 523 bool TestWindowServerDelegate::IsTestConfig() const { |
523 return true; | 524 return true; |
524 } | 525 } |
525 | 526 |
| 527 display::ScreenBase* TestWindowServerDelegate::GetScreen() { |
| 528 if (!screen_) |
| 529 screen_ = base::MakeUnique<display::ScreenBase>(); |
| 530 return screen_.get(); |
| 531 } |
| 532 |
526 // WindowServerTestHelper --------------------------------------------------- | 533 // WindowServerTestHelper --------------------------------------------------- |
527 | 534 |
528 WindowServerTestHelper::WindowServerTestHelper() | 535 WindowServerTestHelper::WindowServerTestHelper() |
529 : cursor_id_(mojom::CursorType::CURSOR_NULL), | 536 : cursor_id_(mojom::CursorType::CURSOR_NULL), |
530 platform_display_factory_(&cursor_id_) { | 537 platform_display_factory_(&cursor_id_) { |
531 // Some tests create their own message loop, for example to add a task runner. | 538 // Some tests create their own message loop, for example to add a task runner. |
532 if (!base::MessageLoop::current()) | 539 if (!base::MessageLoop::current()) |
533 message_loop_ = base::MakeUnique<base::MessageLoop>(); | 540 message_loop_ = base::MakeUnique<base::MessageLoop>(); |
534 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); | 541 PlatformDisplay::set_factory_for_testing(&platform_display_factory_); |
535 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_); | 542 window_server_ = base::MakeUnique<WindowServer>(&window_server_delegate_); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (!tree->AddWindow(parent_client_id, client_window_id)) | 693 if (!tree->AddWindow(parent_client_id, client_window_id)) |
687 return nullptr; | 694 return nullptr; |
688 if (client_id) | 695 if (client_id) |
689 *client_id = client_window_id; | 696 *client_id = client_window_id; |
690 return tree->GetWindowByClientId(client_window_id); | 697 return tree->GetWindowByClientId(client_window_id); |
691 } | 698 } |
692 | 699 |
693 } // namespace test | 700 } // namespace test |
694 } // namespace ws | 701 } // namespace ws |
695 } // namespace ui | 702 } // namespace ui |
OLD | NEW |