| 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/common/test/ash_test.h" | 5 #include "ash/common/test/ash_test.h" |
| 6 | 6 |
| 7 #include "ash/common/test/ash_test_impl.h" | 7 #include "ash/common/test/ash_test_impl.h" |
| 8 #include "ash/common/wm_shell.h" |
| 8 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ui/compositor/layer_type.h" |
| 9 #include "ui/display/display.h" | 11 #include "ui/display/display.h" |
| 10 | 12 |
| 11 namespace ash { | 13 namespace ash { |
| 12 | 14 |
| 13 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {} | 15 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {} |
| 14 | 16 |
| 15 WindowOwner::~WindowOwner() { | 17 WindowOwner::~WindowOwner() { |
| 16 window_->Destroy(); | 18 window_->Destroy(); |
| 17 } | 19 } |
| 18 | 20 |
| 19 AshTest::AshTest() : test_impl_(AshTestImpl::Create()) {} | 21 AshTest::AshTest() : test_impl_(AshTestImpl::Create()) {} |
| 20 | 22 |
| 21 AshTest::~AshTest() {} | 23 AshTest::~AshTest() {} |
| 22 | 24 |
| 23 bool AshTest::SupportsMultipleDisplays() const { | 25 bool AshTest::SupportsMultipleDisplays() const { |
| 24 return test_impl_->SupportsMultipleDisplays(); | 26 return test_impl_->SupportsMultipleDisplays(); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void AshTest::UpdateDisplay(const std::string& display_spec) { | 29 void AshTest::UpdateDisplay(const std::string& display_spec) { |
| 28 return test_impl_->UpdateDisplay(display_spec); | 30 return test_impl_->UpdateDisplay(display_spec); |
| 29 } | 31 } |
| 30 | 32 |
| 31 std::unique_ptr<WindowOwner> AshTest::CreateTestWindow(const gfx::Rect& bounds, | 33 std::unique_ptr<WindowOwner> AshTest::CreateTestWindow(const gfx::Rect& bounds, |
| 32 ui::wm::WindowType type, | 34 ui::wm::WindowType type, |
| 33 int shell_window_id) { | 35 int shell_window_id) { |
| 34 return test_impl_->CreateTestWindow(bounds, type, shell_window_id); | 36 return test_impl_->CreateTestWindow(bounds, type, shell_window_id); |
| 35 } | 37 } |
| 36 | 38 |
| 39 std::unique_ptr<WindowOwner> AshTest::CreateChildWindow(WmWindow* parent, |
| 40 const gfx::Rect& bounds, |
| 41 int shell_window_id) { |
| 42 std::unique_ptr<WindowOwner> window_owner = |
| 43 base::MakeUnique<WindowOwner>(WmShell::Get()->NewWindow( |
| 44 ui::wm::WINDOW_TYPE_NORMAL, ui::LAYER_NOT_DRAWN)); |
| 45 window_owner->window()->SetBounds(bounds); |
| 46 window_owner->window()->SetShellWindowId(shell_window_id); |
| 47 parent->AddChild(window_owner->window()); |
| 48 window_owner->window()->Show(); |
| 49 return window_owner; |
| 50 } |
| 51 |
| 37 display::Display AshTest::GetSecondaryDisplay() { | 52 display::Display AshTest::GetSecondaryDisplay() { |
| 38 return test_impl_->GetSecondaryDisplay(); | 53 return test_impl_->GetSecondaryDisplay(); |
| 39 } | 54 } |
| 40 | 55 |
| 41 bool AshTest::SetSecondaryDisplayPlacement( | 56 bool AshTest::SetSecondaryDisplayPlacement( |
| 42 display::DisplayPlacement::Position position, | 57 display::DisplayPlacement::Position position, |
| 43 int offset) { | 58 int offset) { |
| 44 return test_impl_->SetSecondaryDisplayPlacement(position, offset); | 59 return test_impl_->SetSecondaryDisplayPlacement(position, offset); |
| 45 } | 60 } |
| 46 | 61 |
| 47 void AshTest::SetUp() { | 62 void AshTest::SetUp() { |
| 48 test_impl_->SetUp(); | 63 test_impl_->SetUp(); |
| 49 } | 64 } |
| 50 | 65 |
| 51 void AshTest::TearDown() { | 66 void AshTest::TearDown() { |
| 52 test_impl_->TearDown(); | 67 test_impl_->TearDown(); |
| 53 } | 68 } |
| 54 | 69 |
| 55 } // namespace ash | 70 } // namespace ash |
| OLD | NEW |