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

Unified Diff: trunk/src/ash/wm/workspace/phantom_window_controller_unittest.cc

Issue 132183006: Revert 244050 "This is part 1 of implemeting phantom windows for..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 11 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: trunk/src/ash/wm/workspace/phantom_window_controller_unittest.cc
===================================================================
--- trunk/src/ash/wm/workspace/phantom_window_controller_unittest.cc (revision 244088)
+++ trunk/src/ash/wm/workspace/phantom_window_controller_unittest.cc (working copy)
@@ -1,170 +0,0 @@
-// Copyright 2014 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/wm/workspace/phantom_window_controller.h"
-
-#include "ash/ash_switches.h"
-#include "ash/shell.h"
-#include "ash/test/ash_test_base.h"
-#include "ui/aura/root_window.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
-#include "ui/views/widget/widget.h"
-
-namespace ash {
-namespace internal {
-
-namespace {
-
-// Returns true if |window| is non-NULL and is visible.
-bool IsVisible(aura::Window* window) {
- return window && window->IsVisible();
-}
-
-// Observes |window|'s deletion.
-class WindowDeletionObserver : public aura::WindowObserver {
- public:
- WindowDeletionObserver(aura::Window* window) : window_(window) {
- window_->AddObserver(this);
- }
-
- virtual ~WindowDeletionObserver() {
- if (window_)
- window_->RemoveObserver(this);
- }
-
- // Returns true if the window has not been deleted yet.
- bool IsWindowAlive() {
- return !!window_;
- }
-
- // aura::WindowObserver:
- virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
- window_->RemoveObserver(this);
- window_ = NULL;
- }
-
- private:
- aura::Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowDeletionObserver);
-};
-
-} // namespace
-
-class PhantomWindowControllerTest : public ash::test::AshTestBase {
- public:
- PhantomWindowControllerTest() {
- }
- virtual ~PhantomWindowControllerTest() {
- }
-
- // ash::test::AshTestBase:
- virtual void SetUp() OVERRIDE {
- ash::test::AshTestBase::SetUp();
-
- UpdateDisplay("500x400,500x400");
- window_ = CreateTestWindowInShellWithBounds(gfx::Rect(0, 0, 50, 60));
- controller_.reset(new PhantomWindowController(window_));
- }
-
- void DeleteController() {
- controller_.reset();
- }
-
- PhantomWindowController* controller() {
- return controller_.get();
- }
-
- aura::Window* window() { return window_; }
-
- aura::Window* phantom_window_in_target_root() {
- return controller_->phantom_widget_in_target_root_ ?
- controller_->phantom_widget_in_target_root_->GetNativeView() :
- NULL;
- }
-
- aura::Window* phantom_window_in_start_root() {
- return controller_->phantom_widget_in_start_root_ ?
- controller_->phantom_widget_in_start_root_->GetNativeView() :
- NULL;
- }
-
- private:
- aura::Window* window_;
- scoped_ptr<PhantomWindowController> controller_;
-
- DISALLOW_COPY_AND_ASSIGN(PhantomWindowControllerTest);
-};
-
-// Test that two phantom windows are used when animating to bounds at least
-// partially in another display.
-TEST_F(PhantomWindowControllerTest, PhantomWindowShow) {
- if (!SupportsMultipleDisplays())
- return;
-
- aura::Window::Windows root_windows = Shell::GetAllRootWindows();
- EXPECT_EQ(root_windows[0], window()->GetRootWindow());
-
- // Phantom preview only in the left screen.
- controller()->Show(gfx::Rect(100, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_FALSE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[0], phantom_window_in_target_root()->GetRootWindow());
-
- // Move phantom preview into the right screen. Test that 2 windows got
- // created.
- controller()->Show(gfx::Rect(600, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_TRUE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[1], phantom_window_in_target_root()->GetRootWindow());
- EXPECT_EQ(root_windows[0], phantom_window_in_start_root()->GetRootWindow());
-
- // Move phantom preview only in the right screen. Start window should close.
- controller()->Show(gfx::Rect(700, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_FALSE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[1], phantom_window_in_target_root()->GetRootWindow());
-
- // Move phantom preview into the left screen. Start window should open.
- controller()->Show(gfx::Rect(100, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_TRUE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[0], phantom_window_in_target_root()->GetRootWindow());
- EXPECT_EQ(root_windows[1], phantom_window_in_start_root()->GetRootWindow());
-
- // Move phantom preview while in the left screen. Start window should close.
- controller()->Show(gfx::Rect(200, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_FALSE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[0], phantom_window_in_target_root()->GetRootWindow());
-
- // Move phantom preview spanning both screens with most of the preview in the
- // right screen. Two windows are created.
- controller()->Show(gfx::Rect(495, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_TRUE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[1], phantom_window_in_target_root()->GetRootWindow());
- EXPECT_EQ(root_windows[0], phantom_window_in_start_root()->GetRootWindow());
-
- // Move phantom preview back into the left screen. Phantom windows should
- // swap.
- controller()->Show(gfx::Rect(200, 100, 50, 60));
- EXPECT_TRUE(IsVisible(phantom_window_in_target_root()));
- EXPECT_TRUE(IsVisible(phantom_window_in_start_root()));
- EXPECT_EQ(root_windows[0], phantom_window_in_target_root()->GetRootWindow());
- EXPECT_EQ(root_windows[1], phantom_window_in_start_root()->GetRootWindow());
-
- // Destroy phantom controller. Both windows should close.
- WindowDeletionObserver target_deletion_observer(
- phantom_window_in_target_root());
- WindowDeletionObserver start_deletion_observer(
- phantom_window_in_start_root());
- DeleteController();
- EXPECT_FALSE(target_deletion_observer.IsWindowAlive());
- EXPECT_FALSE(start_deletion_observer.IsWindowAlive());
-}
-
-} // namespace internal
-} // namespace ash
« no previous file with comments | « trunk/src/ash/wm/workspace/phantom_window_controller.cc ('k') | trunk/src/ash/wm/workspace/workspace_window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698