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

Unified Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 101773004: Refactor PhantomWindowController so that the PhantomWindowController owns the phantom window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/wm/workspace/workspace_window_resizer_unittest.cc
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 599c4ea98e88ae314d7e5a73b75e1f4d1593c515..124f11fc4044d73df9525aec12142ef0ea5a29f6 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -30,37 +30,6 @@
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
-namespace gfx {
-
-// Class to provide access to SlideAnimation internals for testing.
-// TODO: this should be next to SlideAnimation, not here.
-class SlideAnimation::TestApi {
- public:
- explicit TestApi(SlideAnimation* animation) : animation_(animation) {}
-
- void SetStartTime(base::TimeTicks ticks) {
- animation_->SetStartTime(ticks);
- }
-
- void Step(base::TimeTicks ticks) {
- animation_->Step(ticks);
- }
-
- void RunTillComplete() {
- SetStartTime(base::TimeTicks());
- Step(base::TimeTicks() +
- base::TimeDelta::FromMilliseconds(animation_->GetSlideDuration()));
- EXPECT_EQ(1.0, animation_->GetCurrentValue());
- }
-
- private:
- SlideAnimation* animation_;
-
- DISALLOW_COPY_AND_ASSIGN(TestApi);
-};
-
-}
-
namespace ash {
namespace internal {
namespace {
@@ -219,12 +188,6 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
touch_outer_insets);
}
- // Simulate running the animation.
- void RunAnimationTillComplete(gfx::SlideAnimation* animation) {
- gfx::SlideAnimation::TestApi test_api(animation);
- test_api.RunTillComplete();
- }
-
TestWindowDelegate delegate_;
TestWindowDelegate delegate2_;
TestWindowDelegate delegate3_;
@@ -1917,111 +1880,5 @@ TEST_F(WorkspaceWindowResizerTest, TouchResizeToEdge_BOTTOM) {
touch_resize_window_->bounds().ToString());
}
-TEST_F(WorkspaceWindowResizerTest, PhantomWindowShow) {
- if (!SupportsMultipleDisplays())
- return;
-
- UpdateDisplay("500x400,500x400");
- window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
- Shell::GetScreen()->GetPrimaryDisplay());
- aura::Window::Windows root_windows = Shell::GetAllRootWindows();
- EXPECT_EQ(root_windows[0], window_->GetRootWindow());
-
- scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
- window_.get(), gfx::Point(), HTCAPTION));
- ASSERT_TRUE(resizer.get());
- EXPECT_FALSE(snap_phantom_window_controller());
-
- // The pointer is on the edge but not shared. The snap phantom window
- // controller should be non-NULL.
- resizer->Drag(CalculateDragPoint(*resizer, -1, 0), 0);
- EXPECT_TRUE(snap_phantom_window_controller());
- PhantomWindowController* phantom_controller(snap_phantom_window_controller());
-
- // phantom widget only in the left screen.
- phantom_controller->Show(gfx::Rect(100, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_FALSE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
-
- // Move phantom widget into the right screen. Test that 2 widgets got created.
- phantom_controller->Show(gfx::Rect(600, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_TRUE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[1],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_start_->GetNativeWindow()->
- GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Move phantom widget only in the right screen. Start widget should close.
- phantom_controller->Show(gfx::Rect(700, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_FALSE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[1],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Move phantom widget into the left screen. Start widget should open.
- phantom_controller->Show(gfx::Rect(100, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_TRUE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- EXPECT_EQ(
- root_windows[1],
- phantom_controller->phantom_widget_start_->GetNativeWindow()->
- GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Move phantom widget while in the left screen. Start widget should close.
- phantom_controller->Show(gfx::Rect(200, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_FALSE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Move phantom widget spanning both screens with most of the window in the
- // right screen. Two widgets are created.
- phantom_controller->Show(gfx::Rect(495, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_TRUE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[1],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_start_->GetNativeWindow()->
- GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Move phantom widget back into the left screen. Phantom widgets should swap.
- phantom_controller->Show(gfx::Rect(200, 100, 50, 60));
- EXPECT_TRUE(phantom_controller->phantom_widget_);
- EXPECT_TRUE(phantom_controller->phantom_widget_start_);
- EXPECT_EQ(
- root_windows[0],
- phantom_controller->phantom_widget_->GetNativeWindow()->GetRootWindow());
- EXPECT_EQ(
- root_windows[1],
- phantom_controller->phantom_widget_start_->GetNativeWindow()->
- GetRootWindow());
- RunAnimationTillComplete(phantom_controller->animation_.get());
-
- // Hide phantom controller. Both widgets should close.
- phantom_controller->Hide();
- EXPECT_FALSE(phantom_controller->phantom_widget_);
- EXPECT_FALSE(phantom_controller->phantom_widget_start_);
-}
-
} // namespace internal
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698