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

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

Issue 557693002: [Ash] Only snap windows that can maximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change ash_test_base.cc Created 6 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
« ash/wm/window_state.cc ('K') | « ash/wm/window_state_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/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 TEST_F(WorkspaceWindowResizerTest, Edge) { 549 TEST_F(WorkspaceWindowResizerTest, Edge) {
550 if (!SupportsHostWindowResize()) 550 if (!SupportsHostWindowResize())
551 return; 551 return;
552 552
553 // Resize host window to force insets update. 553 // Resize host window to force insets update.
554 UpdateDisplay("800x700"); 554 UpdateDisplay("800x700");
555 // TODO(varkha): Insets are reset after every drag because of 555 // TODO(varkha): Insets are reset after every drag because of
556 // http://crbug.com/292238. 556 // http://crbug.com/292238.
557 // Window is wide enough not to get docked right away. 557 // Window is wide enough not to get docked right away.
558 window_->SetBounds(gfx::Rect(20, 30, 400, 60)); 558 window_->SetBounds(gfx::Rect(20, 30, 400, 60));
559 window_->SetProperty(aura::client::kCanMaximizeKey, true);
559 wm::WindowState* window_state = wm::GetWindowState(window_.get()); 560 wm::WindowState* window_state = wm::GetWindowState(window_.get());
560 561
561 { 562 {
562 gfx::Rect expected_bounds_in_parent( 563 gfx::Rect expected_bounds_in_parent(
563 wm::GetDefaultLeftSnappedWindowBoundsInParent(window_.get())); 564 wm::GetDefaultLeftSnappedWindowBoundsInParent(window_.get()));
564 565
565 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( 566 scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
566 window_.get(), gfx::Point(), HTCAPTION)); 567 window_.get(), gfx::Point(), HTCAPTION));
567 ASSERT_TRUE(resizer.get()); 568 ASSERT_TRUE(resizer.get());
568 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0); 569 resizer->Drag(CalculateDragPoint(*resizer, 0, 10), 0);
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( 1409 scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
1409 window_.get(), gfx::Point(), HTLEFT)); 1410 window_.get(), gfx::Point(), HTLEFT));
1410 ASSERT_TRUE(resizer.get()); 1411 ASSERT_TRUE(resizer.get());
1411 resizer->Drag(CalculateDragPoint(*resizer, 0, 0), 0); 1412 resizer->Drag(CalculateDragPoint(*resizer, 0, 0), 0);
1412 EXPECT_EQ("99,200 21x30", window_->bounds().ToString()); 1413 EXPECT_EQ("99,200 21x30", window_->bounds().ToString());
1413 } 1414 }
1414 1415
1415 // Test that the user user moved window flag is getting properly set. 1416 // Test that the user user moved window flag is getting properly set.
1416 TEST_F(WorkspaceWindowResizerTest, CheckUserWindowManagedFlags) { 1417 TEST_F(WorkspaceWindowResizerTest, CheckUserWindowManagedFlags) {
1417 window_->SetBounds(gfx::Rect( 0, 50, 400, 200)); 1418 window_->SetBounds(gfx::Rect( 0, 50, 400, 200));
1419 window_->SetProperty(aura::client::kCanMaximizeKey, true);
1418 1420
1419 std::vector<aura::Window*> no_attached_windows; 1421 std::vector<aura::Window*> no_attached_windows;
1420 // Check that an abort doesn't change anything. 1422 // Check that an abort doesn't change anything.
1421 { 1423 {
1422 scoped_ptr<WindowResizer> resizer(CreateResizerForTest( 1424 scoped_ptr<WindowResizer> resizer(CreateResizerForTest(
1423 window_.get(), gfx::Point(), HTCAPTION)); 1425 window_.get(), gfx::Point(), HTCAPTION));
1424 ASSERT_TRUE(resizer.get()); 1426 ASSERT_TRUE(resizer.get());
1425 // Move it 100 to the bottom. 1427 // Move it 100 to the bottom.
1426 resizer->Drag(CalculateDragPoint(*resizer, 0, 100), 0); 1428 resizer->Drag(CalculateDragPoint(*resizer, 0, 100), 0);
1427 EXPECT_EQ("0,150 400x200", window_->bounds().ToString()); 1429 EXPECT_EQ("0,150 400x200", window_->bounds().ToString());
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 // Drag even more to snap to the edge. 1880 // Drag even more to snap to the edge.
1879 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), 1881 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40),
1880 gfx::Point(400, kRootHeight - 25), 1882 gfx::Point(400, kRootHeight - 25),
1881 base::TimeDelta::FromMilliseconds(10), 1883 base::TimeDelta::FromMilliseconds(10),
1882 5); 1884 5);
1883 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), 1885 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(),
1884 touch_resize_window_->bounds().ToString()); 1886 touch_resize_window_->bounds().ToString());
1885 } 1887 }
1886 1888
1887 } // namespace ash 1889 } // namespace ash
OLDNEW
« ash/wm/window_state.cc ('K') | « ash/wm/window_state_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698