| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/test/ash_test_impl_aura.h" |
| 6 |
| 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/test/ash_test.h" |
| 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/screen_util.h" |
| 11 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/display_manager_test_api.h" |
| 14 #include "base/memory/ptr_util.h" |
| 15 #include "ui/display/manager/display_layout.h" |
| 16 #include "ui/display/screen.h" |
| 17 |
| 18 namespace ash { |
| 19 namespace { |
| 20 |
| 21 // AshTestBase is abstract as TestBody() is pure virtual (the various TEST |
| 22 // macros have the implementation). In order to create AshTestBase we have to |
| 23 // subclass with an empty implementation of TestBody(). That's ok as the class |
| 24 // isn't used as a normal test here. |
| 25 class AshTestBaseImpl : public test::AshTestBase { |
| 26 public: |
| 27 AshTestBaseImpl() {} |
| 28 ~AshTestBaseImpl() override {} |
| 29 |
| 30 // AshTestBase: |
| 31 void TestBody() override {} |
| 32 |
| 33 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(AshTestBaseImpl); |
| 35 }; |
| 36 |
| 37 } // namespace |
| 38 |
| 39 AshTestImplAura::AshTestImplAura() |
| 40 : ash_test_base_(base::MakeUnique<AshTestBaseImpl>()) {} |
| 41 |
| 42 AshTestImplAura::~AshTestImplAura() {} |
| 43 |
| 44 void AshTestImplAura::SetUp() { |
| 45 ash_test_base_->SetUp(); |
| 46 } |
| 47 |
| 48 void AshTestImplAura::TearDown() { |
| 49 ash_test_base_->TearDown(); |
| 50 } |
| 51 |
| 52 bool AshTestImplAura::SupportsMultipleDisplays() const { |
| 53 return ash_test_base_->SupportsMultipleDisplays(); |
| 54 } |
| 55 |
| 56 void AshTestImplAura::UpdateDisplay(const std::string& display_spec) { |
| 57 ash_test_base_->UpdateDisplay(display_spec); |
| 58 } |
| 59 |
| 60 std::unique_ptr<WindowOwner> AshTestImplAura::CreateTestWindow( |
| 61 const gfx::Rect& bounds_in_screen, |
| 62 ui::wm::WindowType type, |
| 63 int shell_window_id) { |
| 64 return base::MakeUnique<WindowOwner>(WmWindowAura::Get( |
| 65 ash_test_base_->CreateTestWindowInShellWithDelegateAndType( |
| 66 nullptr, type, shell_window_id, bounds_in_screen))); |
| 67 } |
| 68 |
| 69 display::Display AshTestImplAura::GetSecondaryDisplay() { |
| 70 return ScreenUtil::GetSecondaryDisplay(); |
| 71 } |
| 72 |
| 73 bool AshTestImplAura::SetSecondaryDisplayPlacement( |
| 74 display::DisplayPlacement::Position position, |
| 75 int offset) { |
| 76 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| 77 test::CreateDisplayLayout(position, 0)); |
| 78 return true; |
| 79 } |
| 80 |
| 81 // static |
| 82 std::unique_ptr<AshTestImpl> AshTestImpl::Create() { |
| 83 return base::MakeUnique<AshTestImplAura>(); |
| 84 } |
| 85 |
| 86 } // namespace ash |
| OLD | NEW |