Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: ash/test/ash_test_impl_aura.cc

Issue 2374893002: Adds AshTest (Closed)
Patch Set: real feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..cf32bc448a44aced969712b2d212f14cd3bffe4c
--- /dev/null
+++ b/ash/test/ash_test_impl_aura.cc
@@ -0,0 +1,86 @@
+// 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 {
+
+// AshTestBase is abstract as TestBody() is pure virtual (the various TEST
+// macros have the implementation). In order to create AshTestBase we have to
+// subclass with an empty implementation of TestBody(). That's ok as the class
+// isn't used as a normal test here.
+class AshTestBaseImpl : public test::AshTestBase {
+ 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(position, 0));
+ return true;
+}
+
+// static
+std::unique_ptr<AshTestImpl> AshTestImpl::Create() {
+ return base::MakeUnique<AshTestImplAura>();
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698