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

Side by Side Diff: ash/wm/drag_window_resizer_unittest.cc

Issue 16539005: Skip mulitple-dispay tests on win8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, and comment Created 7 years, 6 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/drag_window_resizer.h" 5 #include "ash/wm/drag_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/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 scoped_ptr<aura::Window> panel_window_; 128 scoped_ptr<aura::Window> panel_window_;
129 aura::Window* transient_child_; 129 aura::Window* transient_child_;
130 scoped_ptr<aura::Window> transient_parent_; 130 scoped_ptr<aura::Window> transient_parent_;
131 131
132 private: 132 private:
133 DISALLOW_COPY_AND_ASSIGN(DragWindowResizerTest); 133 DISALLOW_COPY_AND_ASSIGN(DragWindowResizerTest);
134 }; 134 };
135 135
136 // Verifies a window can be moved from the primary display to another. 136 // Verifies a window can be moved from the primary display to another.
137 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { 137 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) {
138 RETURN_IF_WIN8;
139
138 // The secondary display is logically on the right, but on the system (e.g. X) 140 // The secondary display is logically on the right, but on the system (e.g. X)
139 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 141 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
140 UpdateDisplay("800x600,800x600"); 142 UpdateDisplay("800x600,800x600");
141 shelf_layout_manager()->LayoutShelf(); 143 shelf_layout_manager()->LayoutShelf();
142 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 144 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
143 ASSERT_EQ(2U, root_windows.size()); 145 ASSERT_EQ(2U, root_windows.size());
144 146
145 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 147 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
146 Shell::GetScreen()->GetPrimaryDisplay()); 148 Shell::GetScreen()->GetPrimaryDisplay());
147 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 149 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Since the pointer is on the secondary, the parent should be changed 192 // Since the pointer is on the secondary, the parent should be changed
191 // even though only small fraction of the window is within the secondary 193 // even though only small fraction of the window is within the secondary
192 // root window's bounds. 194 // root window's bounds.
193 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 195 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
194 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); 196 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString());
195 } 197 }
196 } 198 }
197 199
198 // Verifies a window can be moved from the secondary display to primary. 200 // Verifies a window can be moved from the secondary display to primary.
199 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) { 201 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) {
202 RETURN_IF_WIN8;
203
200 UpdateDisplay("800x600,800x600"); 204 UpdateDisplay("800x600,800x600");
201 shelf_layout_manager()->LayoutShelf(); 205 shelf_layout_manager()->LayoutShelf();
202 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 206 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
203 ASSERT_EQ(2U, root_windows.size()); 207 ASSERT_EQ(2U, root_windows.size());
204 208
205 window_->SetBoundsInScreen( 209 window_->SetBoundsInScreen(
206 gfx::Rect(800, 00, 50, 60), 210 gfx::Rect(800, 00, 50, 60),
207 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); 211 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1]));
208 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 212 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
209 { 213 {
210 // Grab (0, 0) of the window. 214 // Grab (0, 0) of the window.
211 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer( 215 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer(
212 window_.get(), gfx::Point(), HTCAPTION)); 216 window_.get(), gfx::Point(), HTCAPTION));
213 ASSERT_TRUE(resizer.get()); 217 ASSERT_TRUE(resizer.get());
214 // Move the mouse near the right edge, (798, 0), of the primary display. 218 // Move the mouse near the right edge, (798, 0), of the primary display.
215 resizer->Drag(CalculateDragPoint(*resizer, -2, 0), ui::EF_CONTROL_DOWN); 219 resizer->Drag(CalculateDragPoint(*resizer, -2, 0), ui::EF_CONTROL_DOWN);
216 resizer->CompleteDrag(0); 220 resizer->CompleteDrag(0);
217 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 221 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
218 EXPECT_EQ("798,0 50x60", window_->bounds().ToString()); 222 EXPECT_EQ("798,0 50x60", window_->bounds().ToString());
219 } 223 }
220 } 224 }
221 225
222 // Verifies the drag window is shown correctly. 226 // Verifies the drag window is shown correctly.
223 TEST_F(DragWindowResizerTest, DragWindowController) { 227 TEST_F(DragWindowResizerTest, DragWindowController) {
228 RETURN_IF_WIN8;
229
224 UpdateDisplay("800x600,800x600"); 230 UpdateDisplay("800x600,800x600");
225 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 231 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
226 ASSERT_EQ(2U, root_windows.size()); 232 ASSERT_EQ(2U, root_windows.size());
227 233
228 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 234 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
229 Shell::GetScreen()->GetPrimaryDisplay()); 235 Shell::GetScreen()->GetPrimaryDisplay());
230 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 236 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
231 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); 237 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
232 { 238 {
233 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer( 239 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer(
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 event_filter->mouse_warp_mode_); 347 event_filter->mouse_warp_mode_);
342 resizer->RevertDrag(); 348 resizer->RevertDrag();
343 } 349 }
344 EXPECT_EQ(MouseCursorEventFilter::WARP_ALWAYS, 350 EXPECT_EQ(MouseCursorEventFilter::WARP_ALWAYS,
345 event_filter->mouse_warp_mode_); 351 event_filter->mouse_warp_mode_);
346 } 352 }
347 353
348 // Verifies cursor's device scale factor is updated whe a window is moved across 354 // Verifies cursor's device scale factor is updated whe a window is moved across
349 // root windows with different device scale factors (http://crbug.com/154183). 355 // root windows with different device scale factors (http://crbug.com/154183).
350 TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { 356 TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
357 RETURN_IF_WIN8;
358
351 // The secondary display is logically on the right, but on the system (e.g. X) 359 // The secondary display is logically on the right, but on the system (e.g. X)
352 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 360 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
353 UpdateDisplay("400x400,800x800*2"); 361 UpdateDisplay("400x400,800x800*2");
354 shelf_layout_manager()->LayoutShelf(); 362 shelf_layout_manager()->LayoutShelf();
355 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 363 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
356 ASSERT_EQ(2U, root_windows.size()); 364 ASSERT_EQ(2U, root_windows.size());
357 365
358 test::CursorManagerTestApi cursor_test_api( 366 test::CursorManagerTestApi cursor_test_api(
359 Shell::GetInstance()->cursor_manager()); 367 Shell::GetInstance()->cursor_manager());
360 MouseCursorEventFilter* event_filter = 368 MouseCursorEventFilter* event_filter =
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 event_filter->WarpMouseCursorIfNecessary(root_windows[1], 402 event_filter->WarpMouseCursorIfNecessary(root_windows[1],
395 gfx::Point(400, 200)); 403 gfx::Point(400, 200));
396 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 404 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
397 resizer->CompleteDrag(0); 405 resizer->CompleteDrag(0);
398 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 406 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
399 } 407 }
400 } 408 }
401 409
402 // Verifies several kinds of windows can be moved across displays. 410 // Verifies several kinds of windows can be moved across displays.
403 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { 411 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
412 RETURN_IF_WIN8;
413
404 // The secondary display is logically on the right, but on the system (e.g. X) 414 // The secondary display is logically on the right, but on the system (e.g. X)
405 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. 415 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
406 UpdateDisplay("400x400,400x400"); 416 UpdateDisplay("400x400,400x400");
407 shelf_layout_manager()->LayoutShelf(); 417 shelf_layout_manager()->LayoutShelf();
408 418
409 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 419 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
410 ASSERT_EQ(2U, root_windows.size()); 420 ASSERT_EQ(2U, root_windows.size());
411 MouseCursorEventFilter* event_filter = 421 MouseCursorEventFilter* event_filter =
412 Shell::GetInstance()->mouse_cursor_filter(); 422 Shell::GetInstance()->mouse_cursor_filter();
413 423
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 ASSERT_TRUE(resizer.get()); 508 ASSERT_TRUE(resizer.get());
499 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 509 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
500 EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0], 510 EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
501 gfx::Point(399, 200))); 511 gfx::Point(399, 200)));
502 resizer->CompleteDrag(0); 512 resizer->CompleteDrag(0);
503 } 513 }
504 } 514 }
505 515
506 } // namespace internal 516 } // namespace internal
507 } // namespace ash 517 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698