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 "ash/mus/test/ash_test_impl_mus.h" | 5 #include "ash/mus/test/ash_test_impl_mus.h" |
6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" |
7 #include "ash/common/test/ash_test.h" | 8 #include "ash/common/test/ash_test.h" |
8 #include "ash/mus/bridge/wm_window_mus.h" | |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "services/ui/public/cpp/property_type_converters.h" | 10 #include "services/ui/public/cpp/property_type_converters.h" |
11 #include "services/ui/public/interfaces/window_manager.mojom.h" | 11 #include "services/ui/public/interfaces/window_manager.mojom.h" |
12 #include "ui/wm/core/window_util.h" | 12 #include "ui/wm/core/window_util.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 namespace mus { | 15 namespace mus { |
16 namespace { | 16 namespace { |
17 | 17 |
18 // WmTestBase is abstract as TestBody() is pure virtual (the various TEST | 18 // WmTestBase is abstract as TestBody() is pure virtual (the various TEST |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 void AshTestImplMus::UpdateDisplay(const std::string& display_spec) { | 53 void AshTestImplMus::UpdateDisplay(const std::string& display_spec) { |
54 wm_test_base_->UpdateDisplay(display_spec); | 54 wm_test_base_->UpdateDisplay(display_spec); |
55 } | 55 } |
56 | 56 |
57 std::unique_ptr<WindowOwner> AshTestImplMus::CreateTestWindow( | 57 std::unique_ptr<WindowOwner> AshTestImplMus::CreateTestWindow( |
58 const gfx::Rect& bounds_in_screen, | 58 const gfx::Rect& bounds_in_screen, |
59 ui::wm::WindowType type, | 59 ui::wm::WindowType type, |
60 int shell_window_id) { | 60 int shell_window_id) { |
61 WmWindowMus* window = | 61 ash::WmWindowAura* window = ash::WmWindowAura::Get( |
62 WmWindowMus::Get(wm_test_base_->CreateTestWindow(bounds_in_screen, type)); | 62 wm_test_base_->CreateTestWindow(bounds_in_screen, type)); |
63 window->SetShellWindowId(shell_window_id); | 63 window->SetShellWindowId(shell_window_id); |
64 return base::MakeUnique<WindowOwner>(window); | 64 return base::MakeUnique<WindowOwner>(window); |
65 } | 65 } |
66 | 66 |
67 std::unique_ptr<WindowOwner> AshTestImplMus::CreateToplevelTestWindow( | 67 std::unique_ptr<WindowOwner> AshTestImplMus::CreateToplevelTestWindow( |
68 const gfx::Rect& bounds_in_screen, | 68 const gfx::Rect& bounds_in_screen, |
69 int shell_window_id) { | 69 int shell_window_id) { |
70 // For mus CreateTestWindow() creates top level windows (assuming | 70 // For mus CreateTestWindow() creates top level windows (assuming |
71 // WINDOW_TYPE_NORMAL). | 71 // WINDOW_TYPE_NORMAL). |
72 return CreateTestWindow(bounds_in_screen, ui::wm::WINDOW_TYPE_NORMAL, | 72 return CreateTestWindow(bounds_in_screen, ui::wm::WINDOW_TYPE_NORMAL, |
73 shell_window_id); | 73 shell_window_id); |
74 } | 74 } |
75 | 75 |
76 display::Display AshTestImplMus::GetSecondaryDisplay() { | 76 display::Display AshTestImplMus::GetSecondaryDisplay() { |
77 return wm_test_base_->GetSecondaryDisplay(); | 77 return wm_test_base_->GetSecondaryDisplay(); |
78 } | 78 } |
79 | 79 |
80 bool AshTestImplMus::SetSecondaryDisplayPlacement( | 80 bool AshTestImplMus::SetSecondaryDisplayPlacement( |
81 display::DisplayPlacement::Position position, | 81 display::DisplayPlacement::Position position, |
82 int offset) { | 82 int offset) { |
83 NOTIMPLEMENTED(); | 83 NOTIMPLEMENTED(); |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 void AshTestImplMus::ConfigureWidgetInitParamsForDisplay( | 87 void AshTestImplMus::ConfigureWidgetInitParamsForDisplay( |
88 WmWindow* window, | 88 WmWindow* window, |
89 views::Widget::InitParams* init_params) { | 89 views::Widget::InitParams* init_params) { |
90 init_params->context = WmWindowMus::GetAuraWindow(window); | 90 init_params->context = WmWindowAura::GetAuraWindow(window); |
91 init_params | 91 init_params |
92 ->mus_properties[ui::mojom::WindowManager::kDisplayId_InitProperty] = | 92 ->mus_properties[ui::mojom::WindowManager::kDisplayId_InitProperty] = |
93 mojo::ConvertTo<std::vector<uint8_t>>( | 93 mojo::ConvertTo<std::vector<uint8_t>>( |
94 window->GetDisplayNearestWindow().id()); | 94 window->GetDisplayNearestWindow().id()); |
95 } | 95 } |
96 | 96 |
97 void AshTestImplMus::AddTransientChild(WmWindow* parent, WmWindow* window) { | 97 void AshTestImplMus::AddTransientChild(WmWindow* parent, WmWindow* window) { |
98 // TODO(sky): remove this as both classes can share same implementation now. | 98 // TODO(sky): remove this as both classes can share same implementation now. |
99 ::wm::AddTransientChild(WmWindowAura::GetAuraWindow(parent), | 99 ::wm::AddTransientChild(WmWindowAura::GetAuraWindow(parent), |
100 WmWindowAura::GetAuraWindow(window)); | 100 WmWindowAura::GetAuraWindow(window)); |
101 } | 101 } |
102 | 102 |
103 } // namespace mus | 103 } // namespace mus |
104 | 104 |
105 // static | 105 // static |
106 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { | 106 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { |
107 return base::MakeUnique<mus::AshTestImplMus>(); | 107 return base::MakeUnique<mus::AshTestImplMus>(); |
108 } | 108 } |
109 | 109 |
110 } // namespace ash | 110 } // namespace ash |
OLD | NEW |