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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 10909043: Cancel drag if display configuration changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix, adjust test screen size Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/display/mouse_cursor_event_filter.h" 7 #include "ash/display/mouse_cursor_event_filter.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 private: 134 private:
135 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest); 135 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest);
136 }; 136 };
137 137
138 } // namespace 138 } // namespace
139 139
140 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented 140 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented
141 // yet for the platform. 141 // yet for the platform.
142 #if defined(OS_WIN) 142 #if defined(OS_WIN)
143 #define MAYBE_WindowDragWithMultiMonitors \ 143 #define MAYBE_WindowDragWithMultiDisplays \
144 DISABLED_WindowDragWithMultiMonitors 144 DISABLED_WindowDragWithMultiDisplays
145 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ 145 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \
146 DISABLED_WindowDragWithMultiMonitorsRightToLeft 146 DISABLED_WindowDragWithMultiDisplaysRightToLeft
147 #define MAYBE_PhantomStyle DISABLED_PhantomStyle 147 #define MAYBE_PhantomStyle DISABLED_PhantomStyle
148 #else 148 #else
149 #define MAYBE_WindowDragWithMultiMonitors WindowDragWithMultiMonitors 149 #define MAYBE_WindowDragWithMultiDisplays WindowDragWithMultiDisplays
150 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ 150 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \
151 WindowDragWithMultiMonitorsRightToLeft 151 WindowDragWithMultiDisplaysRightToLeft
152 #define MAYBE_PhantomStyle PhantomStyle 152 #define MAYBE_PhantomStyle PhantomStyle
153 #endif 153 #endif
154 154
155 // Assertions around attached window resize dragging from the right with 2 155 // Assertions around attached window resize dragging from the right with 2
156 // windows. 156 // windows.
157 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { 157 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) {
158 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); 158 window_->SetBounds(gfx::Rect(0, 300, 400, 300));
159 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); 159 window2_->SetBounds(gfx::Rect(400, 200, 100, 200));
160 160
161 std::vector<aura::Window*> windows; 161 std::vector<aura::Window*> windows;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 ASSERT_TRUE(resizer.get()); 479 ASSERT_TRUE(resizer.get());
480 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); 480 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
481 resizer->CompleteDrag(0); 481 resizer->CompleteDrag(0);
482 EXPECT_EQ("400,0 400x" + base::IntToString(bottom), 482 EXPECT_EQ("400,0 400x" + base::IntToString(bottom),
483 window_->bounds().ToString()); 483 window_->bounds().ToString());
484 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); 484 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
485 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); 485 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString());
486 } 486 }
487 487
488 // Verifies a window can be moved from the primary display to another. 488 // Verifies a window can be moved from the primary display to another.
489 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiMonitors) { 489 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
490 // The secondary display is logically on the right, but on the system (e.g. X) 490 // The secondary display is logically on the right, but on the system (e.g. X)
491 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 491 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
492 UpdateDisplay("800x600,800x600"); 492 UpdateDisplay("800x600,800x600");
493 Shell::GetInstance()->shelf()->LayoutShelf(); 493 Shell::GetInstance()->shelf()->LayoutShelf();
494 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 494 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
495 ASSERT_EQ(2U, root_windows.size()); 495 ASSERT_EQ(2U, root_windows.size());
496 496
497 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 497 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
498 gfx::Screen::GetPrimaryDisplay()); 498 gfx::Screen::GetPrimaryDisplay());
499 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 499 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 // Since the pointer is on the secondary, the parent should not be changed 546 // Since the pointer is on the secondary, the parent should not be changed
547 // even though only small fraction of the window is within the secondary 547 // even though only small fraction of the window is within the secondary
548 // root window's bounds. 548 // root window's bounds.
549 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 549 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
550 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); 550 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString());
551 } 551 }
552 } 552 }
553 553
554 // Verifies a window can be moved from the secondary display to primary. 554 // Verifies a window can be moved from the secondary display to primary.
555 TEST_F(WorkspaceWindowResizerTest, 555 TEST_F(WorkspaceWindowResizerTest,
556 MAYBE_WindowDragWithMultiMonitorsRightToLeft) { 556 MAYBE_WindowDragWithMultiDisplaysRightToLeft) {
557 UpdateDisplay("800x600,800x600"); 557 UpdateDisplay("800x600,800x600");
558 Shell::GetInstance()->shelf()->LayoutShelf(); 558 Shell::GetInstance()->shelf()->LayoutShelf();
559 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 559 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
560 ASSERT_EQ(2U, root_windows.size()); 560 ASSERT_EQ(2U, root_windows.size());
561 561
562 window_->SetBoundsInScreen( 562 window_->SetBoundsInScreen(
563 gfx::Rect(800, 00, 50, 60), 563 gfx::Rect(800, 00, 50, 60),
564 gfx::Screen::GetDisplayNearestWindow(root_windows[1])); 564 gfx::Screen::GetDisplayNearestWindow(root_windows[1]));
565 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 565 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
566 { 566 {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 ASSERT_TRUE(resizer.get()); 899 ASSERT_TRUE(resizer.get());
900 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, 900 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin,
901 // the window should move to the exact position. 901 // the window should move to the exact position.
902 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); 902 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0);
903 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); 903 resizer->CompleteDrag(ui::EF_CONTROL_DOWN);
904 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); 904 EXPECT_EQ("106,124 320x160", window_->bounds().ToString());
905 } 905 }
906 906
907 } // namespace internal 907 } // namespace internal
908 } // namespace ash 908 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698