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/workspace/workspace_window_resizer_unittest.cc

Issue 2739703003: Last sets of tests that can move to common_unittests (Closed)
Patch Set: comments Created 3 years, 9 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
« no previous file with comments | « ash/wm/workspace/workspace_event_handler_unittest.cc ('k') | no next file » | 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/common/wm/workspace/workspace_window_resizer.h" 5 #include "ash/common/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/wm/window_positioning_utils.h" 10 #include "ash/common/wm/window_positioning_utils.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // 100 up again. 490 // 100 up again.
491 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0); 491 resizer->Drag(CalculateDragPoint(*resizer, -10, -100), 0);
492 EXPECT_EQ("0,0 200x100", window_->bounds().ToString()); 492 EXPECT_EQ("0,0 200x100", window_->bounds().ToString());
493 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString()); 493 EXPECT_EQ("10,100 200x266", window2_->bounds().ToString());
494 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString()); 494 EXPECT_EQ("20,366 100x134", window3_->bounds().ToString());
495 } 495 }
496 496
497 // Tests that touch-dragging a window does not lock the mouse cursor 497 // Tests that touch-dragging a window does not lock the mouse cursor
498 // and therefore shows the cursor on a mousemove. 498 // and therefore shows the cursor on a mousemove.
499 TEST_F(WorkspaceWindowResizerTest, MouseMoveWithTouchDrag) { 499 TEST_F(WorkspaceWindowResizerTest, MouseMoveWithTouchDrag) {
500 // TODO: fails because mash doesn't support CursorManager.
501 // http://crbug.com/631103.
502 if (WmShell::Get()->IsRunningInMash())
503 return;
504
500 window_->SetBounds(gfx::Rect(0, 300, 400, 300)); 505 window_->SetBounds(gfx::Rect(0, 300, 400, 300));
501 window2_->SetBounds(gfx::Rect(400, 200, 100, 200)); 506 window2_->SetBounds(gfx::Rect(400, 200, 100, 200));
502 507
503 Shell* shell = Shell::GetInstance(); 508 Shell* shell = Shell::GetInstance();
504 ui::test::EventGenerator generator(window_->GetRootWindow()); 509 ui::test::EventGenerator generator(window_->GetRootWindow());
505 510
506 // The cursor should not be locked initially. 511 // The cursor should not be locked initially.
507 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked()); 512 EXPECT_FALSE(shell->cursor_manager()->IsCursorLocked());
508 513
509 std::vector<aura::Window*> windows; 514 std::vector<aura::Window*> windows;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 587
583 // Restore the window to clear snapped state. 588 // Restore the window to clear snapped state.
584 window_state->Restore(); 589 window_state->Restore();
585 590
586 // Test if the restore bounds is correct in multiple displays. 591 // Test if the restore bounds is correct in multiple displays.
587 UpdateDisplay("800x600,500x600"); 592 UpdateDisplay("800x600,500x600");
588 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 593 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
589 EXPECT_EQ(root_windows[0], window_->GetRootWindow()); 594 EXPECT_EQ(root_windows[0], window_->GetRootWindow());
590 // Window is wide enough not to get docked right away. 595 // Window is wide enough not to get docked right away.
591 window_->SetBoundsInScreen(gfx::Rect(800, 10, 400, 60), 596 window_->SetBoundsInScreen(gfx::Rect(800, 10, 400, 60),
592 display_manager()->GetSecondaryDisplay()); 597 GetSecondaryDisplay());
593 EXPECT_EQ(root_windows[1], window_->GetRootWindow()); 598 EXPECT_EQ(root_windows[1], window_->GetRootWindow());
594 { 599 {
595 EXPECT_EQ("800,10 400x60", window_->GetBoundsInScreen().ToString()); 600 EXPECT_EQ("800,10 400x60", window_->GetBoundsInScreen().ToString());
596 601
597 std::unique_ptr<WindowResizer> resizer( 602 std::unique_ptr<WindowResizer> resizer(
598 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION)); 603 CreateResizerForTest(window_.get(), gfx::Point(), HTCAPTION));
599 ASSERT_TRUE(resizer.get()); 604 ASSERT_TRUE(resizer.get());
600 resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0); 605 resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0);
601 int bottom = 606 int bottom =
602 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom(); 607 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 touch_resize_window_->bounds().ToString()); 1879 touch_resize_window_->bounds().ToString());
1875 // Drag even more to snap to the edge. 1880 // Drag even more to snap to the edge.
1876 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1881 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1877 gfx::Point(400, kRootHeight - 25), 1882 gfx::Point(400, kRootHeight - 25),
1878 base::TimeDelta::FromMilliseconds(10), 5); 1883 base::TimeDelta::FromMilliseconds(10), 5);
1879 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1884 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1880 touch_resize_window_->bounds().ToString()); 1885 touch_resize_window_->bounds().ToString());
1881 } 1886 }
1882 1887
1883 } // namespace ash 1888 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_event_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698