| OLD | NEW |
| 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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void SetUp() override { | 72 void SetUp() override { |
| 73 AshMDTestBase::SetUp(); | 73 AshMDTestBase::SetUp(); |
| 74 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); | 74 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); |
| 75 // Ignore the touch slop region. | 75 // Ignore the touch slop region. |
| 76 ui::GestureConfiguration::GetInstance() | 76 ui::GestureConfiguration::GetInstance() |
| 77 ->set_max_touch_move_in_pixels_for_click(0); | 77 ->set_max_touch_move_in_pixels_for_click(0); |
| 78 | 78 |
| 79 aura::Window* root = Shell::GetPrimaryRootWindow(); | 79 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 80 gfx::Rect root_bounds(root->bounds()); | 80 gfx::Rect root_bounds(root->bounds()); |
| 81 #if defined(OS_WIN) | |
| 82 // RootWindow and Display can't resize on Windows Ash. | |
| 83 // http://crbug.com/165962 | |
| 84 EXPECT_EQ(kRootHeight, root_bounds.height()); | |
| 85 #endif | |
| 86 EXPECT_EQ(800, root_bounds.width()); | 81 EXPECT_EQ(800, root_bounds.width()); |
| 87 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 82 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
| 88 window_.reset(new aura::Window(&delegate_)); | 83 window_.reset(new aura::Window(&delegate_)); |
| 89 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 84 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 90 window_->Init(ui::LAYER_NOT_DRAWN); | 85 window_->Init(ui::LAYER_NOT_DRAWN); |
| 91 ParentWindowInPrimaryRootWindow(window_.get()); | 86 ParentWindowInPrimaryRootWindow(window_.get()); |
| 92 window_->set_id(1); | 87 window_->set_id(1); |
| 93 | 88 |
| 94 window2_.reset(new aura::Window(&delegate2_)); | 89 window2_.reset(new aura::Window(&delegate2_)); |
| 95 window2_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 90 window2_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 EXPECT_EQ("0,50 400x300", window_->bounds().ToString()); | 412 EXPECT_EQ("0,50 400x300", window_->bounds().ToString()); |
| 418 EXPECT_EQ("0,350 200x100", window2_->bounds().ToString()); | 413 EXPECT_EQ("0,350 200x100", window2_->bounds().ToString()); |
| 419 | 414 |
| 420 // Revert and make sure everything moves back. | 415 // Revert and make sure everything moves back. |
| 421 resizer->Drag(CalculateDragPoint(*resizer, 800, 20), 0); | 416 resizer->Drag(CalculateDragPoint(*resizer, 800, 20), 0); |
| 422 resizer->RevertDrag(); | 417 resizer->RevertDrag(); |
| 423 EXPECT_EQ("0,50 400x200", window_->bounds().ToString()); | 418 EXPECT_EQ("0,50 400x200", window_->bounds().ToString()); |
| 424 EXPECT_EQ("0,250 200x100", window2_->bounds().ToString()); | 419 EXPECT_EQ("0,250 200x100", window2_->bounds().ToString()); |
| 425 } | 420 } |
| 426 | 421 |
| 427 #if defined(OS_CHROMEOS) | |
| 428 // Assertions around attached window resize dragging from the bottom with 3 | 422 // Assertions around attached window resize dragging from the bottom with 3 |
| 429 // windows. | 423 // windows. |
| 430 TEST_P(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { | 424 TEST_P(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { |
| 431 UpdateDisplay("600x800"); | 425 UpdateDisplay("600x800"); |
| 432 aura::Window* root = Shell::GetPrimaryRootWindow(); | 426 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 433 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 427 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
| 434 | 428 |
| 435 window_->SetBounds(gfx::Rect(300, 100, 300, 200)); | 429 window_->SetBounds(gfx::Rect(300, 100, 300, 200)); |
| 436 window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); | 430 window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); |
| 437 window3_->SetBounds(gfx::Rect(300, 450, 200, 100)); | 431 window3_->SetBounds(gfx::Rect(300, 450, 200, 100)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 462 EXPECT_EQ("300,100 300x610", window_->bounds().ToString()); | 456 EXPECT_EQ("300,100 300x610", window_->bounds().ToString()); |
| 463 EXPECT_EQ("300,710 200x52", window2_->bounds().ToString()); | 457 EXPECT_EQ("300,710 200x52", window2_->bounds().ToString()); |
| 464 EXPECT_EQ("300,762 200x38", window3_->bounds().ToString()); | 458 EXPECT_EQ("300,762 200x38", window3_->bounds().ToString()); |
| 465 | 459 |
| 466 // Revert and make sure everything moves back. | 460 // Revert and make sure everything moves back. |
| 467 resizer->RevertDrag(); | 461 resizer->RevertDrag(); |
| 468 EXPECT_EQ("300,100 300x200", window_->bounds().ToString()); | 462 EXPECT_EQ("300,100 300x200", window_->bounds().ToString()); |
| 469 EXPECT_EQ("300,300 200x150", window2_->bounds().ToString()); | 463 EXPECT_EQ("300,300 200x150", window2_->bounds().ToString()); |
| 470 EXPECT_EQ("300,450 200x100", window3_->bounds().ToString()); | 464 EXPECT_EQ("300,450 200x100", window3_->bounds().ToString()); |
| 471 } | 465 } |
| 472 #endif // defined(OS_CHROMEOS) | |
| 473 | 466 |
| 474 // Assertions around attached window resizing (collapsing and expanding) with | 467 // Assertions around attached window resizing (collapsing and expanding) with |
| 475 // 3 windows. | 468 // 3 windows. |
| 476 TEST_P(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3_Compress) { | 469 TEST_P(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3_Compress) { |
| 477 window_->SetBounds(gfx::Rect(0, 0, 200, 200)); | 470 window_->SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 478 window2_->SetBounds(gfx::Rect(10, 200, 200, 200)); | 471 window2_->SetBounds(gfx::Rect(10, 200, 200, 200)); |
| 479 window3_->SetBounds(gfx::Rect(20, 400, 100, 100)); | 472 window3_->SetBounds(gfx::Rect(20, 400, 100, 100)); |
| 480 delegate2_.set_min_size(gfx::Size(52, 50)); | 473 delegate2_.set_min_size(gfx::Size(52, 50)); |
| 481 delegate3_.set_min_size(gfx::Size(38, 50)); | 474 delegate3_.set_min_size(gfx::Size(38, 50)); |
| 482 | 475 |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 touch_resize_window_->bounds().ToString()); | 1879 touch_resize_window_->bounds().ToString()); |
| 1887 // Drag even more to snap to the edge. | 1880 // Drag even more to snap to the edge. |
| 1888 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1881 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
| 1889 gfx::Point(400, kRootHeight - 25), | 1882 gfx::Point(400, kRootHeight - 25), |
| 1890 base::TimeDelta::FromMilliseconds(10), 5); | 1883 base::TimeDelta::FromMilliseconds(10), 5); |
| 1891 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1884 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
| 1892 touch_resize_window_->bounds().ToString()); | 1885 touch_resize_window_->bounds().ToString()); |
| 1893 } | 1886 } |
| 1894 | 1887 |
| 1895 } // namespace ash | 1888 } // namespace ash |
| OLD | NEW |