Chromium Code Reviews| Index: ash/test/ash_test_impl_aura.cc |
| diff --git a/ash/test/ash_test_impl_aura.cc b/ash/test/ash_test_impl_aura.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..72a9aba723dd436abe75551692725e6286bb1007 |
| --- /dev/null |
| +++ b/ash/test/ash_test_impl_aura.cc |
| @@ -0,0 +1,88 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/test/ash_test_impl_aura.h" |
| + |
| +#include "ash/aura/wm_window_aura.h" |
| +#include "ash/common/test/ash_test.h" |
| +#include "ash/display/display_manager.h" |
| +#include "ash/screen_util.h" |
| +#include "ash/shell.h" |
| +#include "ash/test/ash_test_base.h" |
| +#include "ash/test/display_manager_test_api.h" |
| +#include "base/memory/ptr_util.h" |
| +#include "ui/display/manager/display_layout.h" |
| +#include "ui/display/screen.h" |
| + |
| +namespace ash { |
| +namespace { |
| + |
| +class AshTestBaseImpl : public test::AshTestBase { |
|
James Cook
2016/09/28 01:19:42
ditto, as with the other one
sky
2016/09/28 17:31:45
Done.
|
| + public: |
| + AshTestBaseImpl() {} |
| + ~AshTestBaseImpl() override {} |
| + |
| + // AshTestBase: |
| + void TestBody() override {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(AshTestBaseImpl); |
| +}; |
| + |
| +} // namespace |
| + |
| +AshTestImplAura::AshTestImplAura() |
| + : ash_test_base_(base::MakeUnique<AshTestBaseImpl>()) {} |
| + |
| +AshTestImplAura::~AshTestImplAura() {} |
| + |
| +void AshTestImplAura::SetUp() { |
| + ash_test_base_->SetUp(); |
| +} |
| + |
| +void AshTestImplAura::TearDown() { |
| + ash_test_base_->TearDown(); |
| +} |
| + |
| +bool AshTestImplAura::SupportsMultipleDisplays() const { |
| + return ash_test_base_->SupportsMultipleDisplays(); |
| +} |
| + |
| +void AshTestImplAura::UpdateDisplay(const std::string& display_spec) { |
| + ash_test_base_->UpdateDisplay(display_spec); |
| +} |
| + |
| +std::unique_ptr<WindowOwner> AshTestImplAura::CreateTestWindow( |
| + const gfx::Rect& bounds_in_screen, |
| + ui::wm::WindowType type, |
| + int shell_window_id) { |
| + return base::MakeUnique<WindowOwner>(WmWindowAura::Get( |
| + ash_test_base_->CreateTestWindowInShellWithDelegateAndType( |
| + nullptr, type, shell_window_id, bounds_in_screen))); |
| +} |
| + |
| +display::Display AshTestImplAura::GetSecondaryDisplay() { |
| + return ScreenUtil::GetSecondaryDisplay(); |
| +} |
| + |
| +bool AshTestImplAura::SetSecondaryDisplayPlacement( |
| + display::DisplayPlacement::Position position, |
| + int offset) { |
| + Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( |
| + test::CreateDisplayLayout(display::DisplayPlacement::TOP, 0)); |
|
James Cook
2016/09/28 01:19:42
TOP seems like an odd default placement. Is that i
sky
2016/09/28 17:31:45
Actually, it should be position.
|
| + return true; |
| +} |
| + |
| +void AshTestImplAura::ConfigureWidgetInitParamsForDisplay( |
| + WmWindow* window, |
| + views::Widget::InitParams* init_params) { |
| + init_params->context = WmWindowAura::GetAuraWindow(window); |
| +} |
| + |
| +// static |
| +std::unique_ptr<AshTestImpl> AshTestImpl::Create() { |
| + return base::MakeUnique<AshTestImplAura>(); |
| +} |
| + |
| +} // namespace ash |