| 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/common/test/ash_test.h" | 7 #include "ash/common/test/ash_test.h" |
| 8 #include "ash/mus/bridge/wm_window_mus.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/cpp/window.h" | 11 #include "services/ui/public/cpp/window.h" |
| 12 #include "services/ui/public/cpp/window_property.h" | 12 #include "services/ui/public/cpp/window_property.h" |
| 13 #include "services/ui/public/interfaces/window_manager.mojom.h" | 13 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 14 #include "ui/wm/core/window_util.h" |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 namespace mus { | 17 namespace mus { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // WmTestBase is abstract as TestBody() is pure virtual (the various TEST | 20 // WmTestBase is abstract as TestBody() is pure virtual (the various TEST |
| 20 // macros have the implementation). In order to create WmTestBase we have to | 21 // macros have the implementation). In order to create WmTestBase we have to |
| 21 // subclass with an empty implementation of TestBody(). That's ok as the class | 22 // subclass with an empty implementation of TestBody(). That's ok as the class |
| 22 // isn't used as a normal test here. | 23 // isn't used as a normal test here. |
| 23 class WmTestBaseImpl : public WmTestBase { | 24 class WmTestBaseImpl : public WmTestBase { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool AshTestImplMus::SetSecondaryDisplayPlacement( | 82 bool AshTestImplMus::SetSecondaryDisplayPlacement( |
| 82 display::DisplayPlacement::Position position, | 83 display::DisplayPlacement::Position position, |
| 83 int offset) { | 84 int offset) { |
| 84 NOTIMPLEMENTED(); | 85 NOTIMPLEMENTED(); |
| 85 return false; | 86 return false; |
| 86 } | 87 } |
| 87 | 88 |
| 88 void AshTestImplMus::ConfigureWidgetInitParamsForDisplay( | 89 void AshTestImplMus::ConfigureWidgetInitParamsForDisplay( |
| 89 WmWindow* window, | 90 WmWindow* window, |
| 90 views::Widget::InitParams* init_params) { | 91 views::Widget::InitParams* init_params) { |
| 92 init_params->context = WmWindowMus::GetAuraWindow(window); |
| 91 init_params | 93 init_params |
| 92 ->mus_properties[ui::mojom::WindowManager::kInitialDisplayId_Property] = | 94 ->mus_properties[ui::mojom::WindowManager::kInitialDisplayId_Property] = |
| 93 mojo::ConvertTo<std::vector<uint8_t>>( | 95 mojo::ConvertTo<std::vector<uint8_t>>( |
| 94 WmWindowMus::GetMusWindow(window)->display_id()); | 96 window->GetDisplayNearestWindow().id()); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void AshTestImplMus::AddTransientChild(WmWindow* parent, WmWindow* window) { | 99 void AshTestImplMus::AddTransientChild(WmWindow* parent, WmWindow* window) { |
| 98 WmWindowMus::GetMusWindow(parent)->AddTransientWindow( | 100 // TODO(sky): remove this as both classes can share same implementation now. |
| 99 WmWindowMus::GetMusWindow(window)); | 101 ::wm::AddTransientChild(WmWindowAura::GetAuraWindow(parent), |
| 102 WmWindowAura::GetAuraWindow(window)); |
| 100 } | 103 } |
| 101 | 104 |
| 102 } // namespace mus | 105 } // namespace mus |
| 103 | 106 |
| 104 // static | 107 // static |
| 105 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { | 108 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { |
| 106 return base::MakeUnique<mus::AshTestImplMus>(); | 109 return base::MakeUnique<mus::AshTestImplMus>(); |
| 107 } | 110 } |
| 108 | 111 |
| 109 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |