| 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/test/ash_test_impl_aura.h" | 5 #include "ash/test/ash_test_impl_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | |
| 8 #include "ash/common/test/ash_test.h" | 7 #include "ash/common/test/ash_test.h" |
| 8 #include "ash/common/wm_window.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "ui/aura/test/test_window_delegate.h" | 13 #include "ui/aura/test/test_window_delegate.h" |
| 14 #include "ui/display/display_layout.h" | 14 #include "ui/display/display_layout.h" |
| 15 #include "ui/display/manager/display_manager.h" | 15 #include "ui/display/manager/display_manager.h" |
| 16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
| 17 #include "ui/display/test/display_manager_test_api.h" | 17 #include "ui/display/test/display_manager_test_api.h" |
| 18 #include "ui/wm/core/window_util.h" | 18 #include "ui/wm/core/window_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 void AshTestImplAura::UpdateDisplay(const std::string& display_spec) { | 58 void AshTestImplAura::UpdateDisplay(const std::string& display_spec) { |
| 59 ash_test_base_->UpdateDisplay(display_spec); | 59 ash_test_base_->UpdateDisplay(display_spec); |
| 60 } | 60 } |
| 61 | 61 |
| 62 std::unique_ptr<WindowOwner> AshTestImplAura::CreateTestWindow( | 62 std::unique_ptr<WindowOwner> AshTestImplAura::CreateTestWindow( |
| 63 const gfx::Rect& bounds_in_screen, | 63 const gfx::Rect& bounds_in_screen, |
| 64 ui::wm::WindowType type, | 64 ui::wm::WindowType type, |
| 65 int shell_window_id) { | 65 int shell_window_id) { |
| 66 return base::MakeUnique<WindowOwner>(WmWindowAura::Get( | 66 return base::MakeUnique<WindowOwner>( |
| 67 ash_test_base_->CreateTestWindowInShellWithDelegateAndType( | 67 WmWindow::Get(ash_test_base_->CreateTestWindowInShellWithDelegateAndType( |
| 68 nullptr, type, shell_window_id, bounds_in_screen))); | 68 nullptr, type, shell_window_id, bounds_in_screen))); |
| 69 } | 69 } |
| 70 | 70 |
| 71 std::unique_ptr<WindowOwner> AshTestImplAura::CreateToplevelTestWindow( | 71 std::unique_ptr<WindowOwner> AshTestImplAura::CreateToplevelTestWindow( |
| 72 const gfx::Rect& bounds_in_screen, | 72 const gfx::Rect& bounds_in_screen, |
| 73 int shell_window_id) { | 73 int shell_window_id) { |
| 74 aura::test::TestWindowDelegate* delegate = | 74 aura::test::TestWindowDelegate* delegate = |
| 75 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); | 75 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); |
| 76 return base::MakeUnique<WindowOwner>(WmWindowAura::Get( | 76 return base::MakeUnique<WindowOwner>( |
| 77 ash_test_base_->CreateTestWindowInShellWithDelegateAndType( | 77 WmWindow::Get(ash_test_base_->CreateTestWindowInShellWithDelegateAndType( |
| 78 delegate, ui::wm::WINDOW_TYPE_NORMAL, shell_window_id, | 78 delegate, ui::wm::WINDOW_TYPE_NORMAL, shell_window_id, |
| 79 bounds_in_screen))); | 79 bounds_in_screen))); |
| 80 } | 80 } |
| 81 | 81 |
| 82 display::Display AshTestImplAura::GetSecondaryDisplay() { | 82 display::Display AshTestImplAura::GetSecondaryDisplay() { |
| 83 return Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); | 83 return Shell::GetInstance()->display_manager()->GetSecondaryDisplay(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool AshTestImplAura::SetSecondaryDisplayPlacement( | 86 bool AshTestImplAura::SetSecondaryDisplayPlacement( |
| 87 display::DisplayPlacement::Position position, | 87 display::DisplayPlacement::Position position, |
| 88 int offset) { | 88 int offset) { |
| 89 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( | 89 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 90 display::test::CreateDisplayLayout( | 90 display::test::CreateDisplayLayout( |
| 91 Shell::GetInstance()->display_manager(), position, 0)); | 91 Shell::GetInstance()->display_manager(), position, 0)); |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void AshTestImplAura::ConfigureWidgetInitParamsForDisplay( | 95 void AshTestImplAura::ConfigureWidgetInitParamsForDisplay( |
| 96 WmWindow* window, | 96 WmWindow* window, |
| 97 views::Widget::InitParams* init_params) { | 97 views::Widget::InitParams* init_params) { |
| 98 init_params->context = WmWindowAura::GetAuraWindow(window); | 98 init_params->context = WmWindow::GetAuraWindow(window); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void AshTestImplAura::AddTransientChild(WmWindow* parent, WmWindow* window) { | 101 void AshTestImplAura::AddTransientChild(WmWindow* parent, WmWindow* window) { |
| 102 ::wm::AddTransientChild(WmWindowAura::GetAuraWindow(parent), | 102 ::wm::AddTransientChild(WmWindow::GetAuraWindow(parent), |
| 103 WmWindowAura::GetAuraWindow(window)); | 103 WmWindow::GetAuraWindow(window)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 // static | 106 // static |
| 107 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { | 107 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { |
| 108 return base::MakeUnique<AshTestImplAura>(); | 108 return base::MakeUnique<AshTestImplAura>(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |