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

Unified Diff: ash/wm/custom_frame_view_ash_unittest.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/wm/custom_frame_view_ash_unittest.cc
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc
index 8036cc65092163211f151d0b3de70fafafffe6a4..66f422e026fe39863fe9407533fc803f4412fa27 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/custom_frame_view_ash_unittest.cc
@@ -11,7 +11,6 @@
#include "ash/wm/window_util.h"
#include "ash/wm/workspace/frame_caption_button_container_view.h"
#include "ash/wm/workspace/frame_maximize_button.h"
-#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_client.h"
@@ -199,10 +198,9 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- internal::SnapSizer sizer(window, center,
- internal::SnapSizer::RIGHT_EDGE,
- internal::SnapSizer::OTHER_INPUT);
- EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
+ gfx::Rect target_bounds = ash::wm::GetSnappedWindowBoundsInParent(
+ window, ash::wm::SNAP_RIGHT_EDGE);
+ EXPECT_EQ(target_bounds.ToString(), window->bounds().ToString());
}
// Snap left.
@@ -216,10 +214,9 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- internal::SnapSizer sizer(window, center,
- internal::SnapSizer::LEFT_EDGE,
- internal::SnapSizer::OTHER_INPUT);
- EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
+ gfx::Rect target_bounds = ash::wm::GetSnappedWindowBoundsInParent(
+ window, ash::wm::SNAP_LEFT_EDGE);
+ EXPECT_EQ(target_bounds.ToString(), window->bounds().ToString());
}
// Minimize.
@@ -250,9 +247,9 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- // This is a short resizing distance and different touch behavior
- // applies which leads in half of the screen being used.
- EXPECT_EQ("400,0 400x552", window->bounds().ToString());
+ gfx::Rect target_bounds = ash::wm::GetSnappedWindowBoundsInParent(
+ window, ash::wm::SNAP_RIGHT_EDGE);
+ EXPECT_EQ(target_bounds.ToString(), window->bounds().ToString());
Mr4D (OOO till 08-26) 2013/08/29 01:03:15 again - better tests of results?
pkotwicz 2013/08/30 21:10:57 I think this is good enough for these tests which
}
// Snap left.
@@ -267,10 +264,9 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- internal::SnapSizer sizer(window, center,
- internal::SnapSizer::LEFT_EDGE,
- internal::SnapSizer::OTHER_INPUT);
- EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
+ gfx::Rect target_bounds = ash::wm::GetSnappedWindowBoundsInParent(
+ window, ash::wm::SNAP_LEFT_EDGE);
+ EXPECT_EQ(target_bounds.ToString(), window->bounds().ToString());
}
// Minimize.
@@ -289,67 +285,6 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
// Test with gesture events.
}
-#if defined(OS_WIN)
-// RootWindow and Display can't resize on Windows Ash. http://crbug.com/165962
-#define MAYBE_TouchDragResizeCloseToCornerDiffersFromMouse \
- DISABLED_TouchDragResizeCloseToCornerDiffersFromMouse
-#else
-#define MAYBE_TouchDragResizeCloseToCornerDiffersFromMouse \
- TouchDragResizeCloseToCornerDiffersFromMouse
-#endif
-
-// Tests Left/Right snapping with resize button touch dragging - which should
-// trigger dependent on the available drag distance.
-TEST_F(CustomFrameViewAshTest,
- MAYBE_TouchDragResizeCloseToCornerDiffersFromMouse) {
- aura::Window* window = widget()->GetNativeWindow();
- views::View* view = maximize_button();
-
- gfx::Rect work_area = widget()->GetWorkAreaBoundsInScreen();
- gfx::Rect bounds = window->bounds();
- bounds.set_x(work_area.width() - bounds.width());
- widget()->SetBounds(bounds);
-
- gfx::Point start_point = view->GetBoundsInScreen().CenterPoint();
- // We want to move all the way to the right (the few pixels we have).
- gfx::Point end_point = gfx::Point(work_area.width(), start_point.y());
-
- aura::test::EventGenerator generator(window->GetRootWindow(), start_point);
-
- EXPECT_TRUE(ash::wm::IsWindowNormal(window));
-
- // Snap right with a touch drag.
- generator.GestureScrollSequence(start_point,
- end_point,
- base::TimeDelta::FromMilliseconds(100),
- 10);
- RunAllPendingInMessageLoop();
-
- EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
- EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- gfx::Rect touch_result = window->bounds();
- EXPECT_NE(bounds.ToString(), touch_result.ToString());
-
- // Set the position back to where it was before and re-try with a mouse.
- widget()->SetBounds(bounds);
-
- generator.MoveMouseTo(start_point);
- generator.PressLeftButton();
- generator.MoveMouseTo(end_point, 10);
- generator.ReleaseLeftButton();
- RunAllPendingInMessageLoop();
-
- EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
- EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- gfx::Rect mouse_result = window->bounds();
-
- // The difference between the two operations should be that the mouse
- // operation should have just started to resize and the touch operation is
- // already all the way down to the smallest possible size.
- EXPECT_NE(mouse_result.ToString(), touch_result.ToString());
- EXPECT_GT(mouse_result.width(), touch_result.width());
-}
-
// Test that closing the (browser) window with an opened balloon does not
// crash the system. In other words: Make sure that shutting down the frame
// destroys the opened balloon in an orderly fashion.
@@ -473,11 +408,9 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftByButton) {
EXPECT_FALSE(ash::wm::IsWindowMaximized(window));
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
- internal::SnapSizer sizer(window, button_pos,
- internal::SnapSizer::LEFT_EDGE,
- internal::SnapSizer::OTHER_INPUT);
- sizer.SelectDefaultSizeAndDisableResize();
- EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
+ gfx::Rect target_bounds = ash::wm::GetSnappedWindowBoundsInParent(
+ window, ash::wm::SNAP_LEFT_EDGE);
+ EXPECT_EQ(target_bounds.ToString(), window->bounds().ToString());
}
// Test that the activation focus does not change when the bubble gets shown.

Powered by Google App Engine
This is Rietveld 408576698