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

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: addressed 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
« no previous file with comments | « ash/wm/activation_controller_unittest.cc ('k') | ash/wm/frame_painter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 if (!SupportsMultipleDisplays())
139 return;
140
138 // The secondary display is logically on the right, but on the system (e.g. X) 141 // 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. 142 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
140 UpdateDisplay("800x600,800x600"); 143 UpdateDisplay("800x600,800x600");
141 shelf_layout_manager()->LayoutShelf(); 144 shelf_layout_manager()->LayoutShelf();
142 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 145 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
143 ASSERT_EQ(2U, root_windows.size()); 146 ASSERT_EQ(2U, root_windows.size());
144 147
145 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 148 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
146 Shell::GetScreen()->GetPrimaryDisplay()); 149 Shell::GetScreen()->GetPrimaryDisplay());
147 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 150 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 193 // 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 194 // even though only small fraction of the window is within the secondary
192 // root window's bounds. 195 // root window's bounds.
193 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 196 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
194 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); 197 EXPECT_EQ("-49,10 50x60", window_->bounds().ToString());
195 } 198 }
196 } 199 }
197 200
198 // Verifies a window can be moved from the secondary display to primary. 201 // Verifies a window can be moved from the secondary display to primary.
199 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) { 202 TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) {
203 if (!SupportsMultipleDisplays())
204 return;
205
200 UpdateDisplay("800x600,800x600"); 206 UpdateDisplay("800x600,800x600");
201 shelf_layout_manager()->LayoutShelf(); 207 shelf_layout_manager()->LayoutShelf();
202 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 208 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
203 ASSERT_EQ(2U, root_windows.size()); 209 ASSERT_EQ(2U, root_windows.size());
204 210
205 window_->SetBoundsInScreen( 211 window_->SetBoundsInScreen(
206 gfx::Rect(800, 00, 50, 60), 212 gfx::Rect(800, 00, 50, 60),
207 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); 213 Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1]));
208 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 214 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
209 { 215 {
210 // Grab (0, 0) of the window. 216 // Grab (0, 0) of the window.
211 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer( 217 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer(
212 window_.get(), gfx::Point(), HTCAPTION)); 218 window_.get(), gfx::Point(), HTCAPTION));
213 ASSERT_TRUE(resizer.get()); 219 ASSERT_TRUE(resizer.get());
214 // Move the mouse near the right edge, (798, 0), of the primary display. 220 // Move the mouse near the right edge, (798, 0), of the primary display.
215 resizer->Drag(CalculateDragPoint(*resizer, -2, 0), ui::EF_CONTROL_DOWN); 221 resizer->Drag(CalculateDragPoint(*resizer, -2, 0), ui::EF_CONTROL_DOWN);
216 resizer->CompleteDrag(0); 222 resizer->CompleteDrag(0);
217 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 223 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
218 EXPECT_EQ("798,0 50x60", window_->bounds().ToString()); 224 EXPECT_EQ("798,0 50x60", window_->bounds().ToString());
219 } 225 }
220 } 226 }
221 227
222 // Verifies the drag window is shown correctly. 228 // Verifies the drag window is shown correctly.
223 TEST_F(DragWindowResizerTest, DragWindowController) { 229 TEST_F(DragWindowResizerTest, DragWindowController) {
230 if (!SupportsMultipleDisplays())
231 return;
232
224 UpdateDisplay("800x600,800x600"); 233 UpdateDisplay("800x600,800x600");
225 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 234 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
226 ASSERT_EQ(2U, root_windows.size()); 235 ASSERT_EQ(2U, root_windows.size());
227 236
228 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), 237 window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
229 Shell::GetScreen()->GetPrimaryDisplay()); 238 Shell::GetScreen()->GetPrimaryDisplay());
230 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 239 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
231 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); 240 EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
232 { 241 {
233 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer( 242 scoped_ptr<DragWindowResizer> resizer(CreateDragWindowResizer(
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 event_filter->mouse_warp_mode_); 350 event_filter->mouse_warp_mode_);
342 resizer->RevertDrag(); 351 resizer->RevertDrag();
343 } 352 }
344 EXPECT_EQ(MouseCursorEventFilter::WARP_ALWAYS, 353 EXPECT_EQ(MouseCursorEventFilter::WARP_ALWAYS,
345 event_filter->mouse_warp_mode_); 354 event_filter->mouse_warp_mode_);
346 } 355 }
347 356
348 // Verifies cursor's device scale factor is updated whe a window is moved across 357 // 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). 358 // root windows with different device scale factors (http://crbug.com/154183).
350 TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { 359 TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) {
360 if (!SupportsMultipleDisplays())
361 return;
362
351 // The secondary display is logically on the right, but on the system (e.g. X) 363 // 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. 364 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
353 UpdateDisplay("400x400,800x800*2"); 365 UpdateDisplay("400x400,800x800*2");
354 shelf_layout_manager()->LayoutShelf(); 366 shelf_layout_manager()->LayoutShelf();
355 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 367 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
356 ASSERT_EQ(2U, root_windows.size()); 368 ASSERT_EQ(2U, root_windows.size());
357 369
358 test::CursorManagerTestApi cursor_test_api( 370 test::CursorManagerTestApi cursor_test_api(
359 Shell::GetInstance()->cursor_manager()); 371 Shell::GetInstance()->cursor_manager());
360 MouseCursorEventFilter* event_filter = 372 MouseCursorEventFilter* event_filter =
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 event_filter->WarpMouseCursorIfNecessary(root_windows[1], 406 event_filter->WarpMouseCursorIfNecessary(root_windows[1],
395 gfx::Point(400, 200)); 407 gfx::Point(400, 200));
396 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 408 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
397 resizer->CompleteDrag(0); 409 resizer->CompleteDrag(0);
398 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); 410 EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor());
399 } 411 }
400 } 412 }
401 413
402 // Verifies several kinds of windows can be moved across displays. 414 // Verifies several kinds of windows can be moved across displays.
403 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { 415 TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) {
416 if (!SupportsMultipleDisplays())
417 return;
418
404 // The secondary display is logically on the right, but on the system (e.g. X) 419 // 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. 420 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc.
406 UpdateDisplay("400x400,400x400"); 421 UpdateDisplay("400x400,400x400");
407 shelf_layout_manager()->LayoutShelf(); 422 shelf_layout_manager()->LayoutShelf();
408 423
409 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 424 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
410 ASSERT_EQ(2U, root_windows.size()); 425 ASSERT_EQ(2U, root_windows.size());
411 MouseCursorEventFilter* event_filter = 426 MouseCursorEventFilter* event_filter =
412 Shell::GetInstance()->mouse_cursor_filter(); 427 Shell::GetInstance()->mouse_cursor_filter();
413 428
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 ASSERT_TRUE(resizer.get()); 513 ASSERT_TRUE(resizer.get());
499 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); 514 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0);
500 EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0], 515 EXPECT_TRUE(event_filter->WarpMouseCursorIfNecessary(root_windows[0],
501 gfx::Point(399, 200))); 516 gfx::Point(399, 200)));
502 resizer->CompleteDrag(0); 517 resizer->CompleteDrag(0);
503 } 518 }
504 } 519 }
505 520
506 } // namespace internal 521 } // namespace internal
507 } // namespace ash 522 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/activation_controller_unittest.cc ('k') | ash/wm/frame_painter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698