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

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: 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 private: 136 private:
137 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest); 137 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest);
138 }; 138 };
139 139
140 } // namespace 140 } // namespace
141 141
142 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented 142 // Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented
143 // yet for the platform. 143 // yet for the platform.
144 #if defined(OS_WIN) 144 #if defined(OS_WIN)
145 #define MAYBE_WindowDragWithMultiMonitors \ 145 #define MAYBE_WindowDragWithMultiDisplays \
146 DISABLED_WindowDragWithMultiMonitors 146 DISABLED_WindowDragWithMultiDisplays
147 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ 147 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \
148 DISABLED_WindowDragWithMultiMonitorsRightToLeft 148 DISABLED_WindowDragWithMultiDisplaysRightToLeft
149 #define MAYBE_PhantomStyle DISABLED_PhantomStyle 149 #define MAYBE_PhantomStyle DISABLED_PhantomStyle
150 #else 150 #else
151 #define MAYBE_WindowDragWithMultiMonitors WindowDragWithMultiMonitors 151 #define MAYBE_WindowDragWithMultiDisplays WindowDragWithMultiDisplays
152 #define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ 152 #define MAYBE_WindowDragWithMultiDisplaysRightToLeft \
153 WindowDragWithMultiMonitorsRightToLeft 153 WindowDragWithMultiDisplaysRightToLeft
154 #define MAYBE_PhantomStyle PhantomStyle 154 #define MAYBE_PhantomStyle PhantomStyle
155 #endif 155 #endif
156 156
157 // Assertions around attached window resize dragging from the right with 2 157 // Assertions around attached window resize dragging from the right with 2
158 // windows. 158 // windows.
159 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { 159 TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) {
160 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); 160 window_->SetBounds(gfx::Rect(0, 300, 400, 300));
161 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); 161 window2_->SetBounds(gfx::Rect(400, 200, 100, 200));
162 162
163 std::vector<aura::Window*> windows; 163 std::vector<aura::Window*> windows;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 ASSERT_TRUE(resizer.get()); 481 ASSERT_TRUE(resizer.get());
482 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0); 482 resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
483 resizer->CompleteDrag(0); 483 resizer->CompleteDrag(0);
484 EXPECT_EQ("400,0 400x" + base::IntToString(bottom), 484 EXPECT_EQ("400,0 400x" + base::IntToString(bottom),
485 window_->bounds().ToString()); 485 window_->bounds().ToString());
486 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get())); 486 ASSERT_TRUE(GetRestoreBoundsInScreen(window_.get()));
487 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); 487 EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString());
488 } 488 }
489 489
490 // Verifies a window can be moved from the primary display to another. 490 // Verifies a window can be moved from the primary display to another.
491 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiMonitors) { 491 TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
492 // The secondary display is logically on the right, but on the system (e.g. X) 492 // The secondary display is logically on the right, but on the system (e.g. X)
493 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 493 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
494 UpdateDisplay("800x600,800x600"); 494 UpdateDisplay("800x600,800x600");
495 Shell::GetInstance()->shelf()->LayoutShelf(); 495 Shell::GetInstance()->shelf()->LayoutShelf();
496 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 496 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
497 ASSERT_EQ(2U, root_windows.size()); 497 ASSERT_EQ(2U, root_windows.size());
498 498
499 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 499 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
500 gfx::Screen::GetPrimaryDisplay()); 500 gfx::Screen::GetPrimaryDisplay());
501 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 501 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Since the pointer is on the secondary, the parent should not be changed 548 // Since the pointer is on the secondary, the parent should not be changed
549 // even though only small fraction of the window is within the secondary 549 // even though only small fraction of the window is within the secondary
550 // root window's bounds. 550 // root window's bounds.
551 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 551 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
552 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); 552 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString());
553 } 553 }
554 } 554 }
555 555
556 // Verifies a window can be moved from the secondary display to primary. 556 // Verifies a window can be moved from the secondary display to primary.
557 TEST_F(WorkspaceWindowResizerTest, 557 TEST_F(WorkspaceWindowResizerTest,
558 MAYBE_WindowDragWithMultiMonitorsRightToLeft) { 558 MAYBE_WindowDragWithMultiDisplaysRightToLeft) {
559 UpdateDisplay("800x600,800x600"); 559 UpdateDisplay("800x600,800x600");
560 Shell::GetInstance()->shelf()->LayoutShelf(); 560 Shell::GetInstance()->shelf()->LayoutShelf();
561 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 561 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
562 ASSERT_EQ(2U, root_windows.size()); 562 ASSERT_EQ(2U, root_windows.size());
563 563
564 window_->SetBoundsInScreen( 564 window_->SetBoundsInScreen(
565 gfx::Rect(800, 00, 50, 60), 565 gfx::Rect(800, 00, 50, 60),
566 gfx::Screen::GetDisplayNearestWindow(root_windows[1])); 566 gfx::Screen::GetDisplayNearestWindow(root_windows[1]));
567 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 567 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
568 { 568 {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 ASSERT_TRUE(resizer.get()); 901 ASSERT_TRUE(resizer.get());
902 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin, 902 // Ctrl + drag the window to new poistion by adding (10, 12) to its origin,
903 // the window should move to the exact position. 903 // the window should move to the exact position.
904 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0); 904 resizer->Drag(CalculateDragPoint(*resizer, 10, 12), 0);
905 resizer->CompleteDrag(ui::EF_CONTROL_DOWN); 905 resizer->CompleteDrag(ui::EF_CONTROL_DOWN);
906 EXPECT_EQ("106,124 320x160", window_->bounds().ToString()); 906 EXPECT_EQ("106,124 320x160", window_->bounds().ToString());
907 } 907 }
908 908
909 } // namespace internal 909 } // namespace internal
910 } // namespace ash 910 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698