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

Side by Side Diff: ash/wm/dock/docked_window_layout_manager_unittest.cc

Issue 2542493002: Replace kCanMaximize/Minimize/Resize with kResizeBehavior. (Closed)
Patch Set: Fix int->bool compile issue. Created 4 years 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/ash_focus_rules_unittest.cc ('k') | ash/wm/lock_layout_manager_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/dock/docked_window_layout_manager.h" 5 #include "ash/common/wm/dock/docked_window_layout_manager.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/test/test_shelf_delegate.h" 9 #include "ash/common/test/test_shelf_delegate.h"
10 #include "ash/common/wm/panels/panel_layout_manager.h" 10 #include "ash/common/wm/panels/panel_layout_manager.h"
11 #include "ash/common/wm/window_resizer.h" 11 #include "ash/common/wm/window_resizer.h"
12 #include "ash/common/wm/window_state.h" 12 #include "ash/common/wm/window_state.h"
13 #include "ash/public/cpp/shell_window_ids.h" 13 #include "ash/public/cpp/shell_window_ids.h"
14 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/shelf_view_test_api.h" 17 #include "ash/test/shelf_view_test_api.h"
18 #include "ash/test/shell_test_api.h" 18 #include "ash/test/shell_test_api.h"
19 #include "ash/wm/window_state_aura.h" 19 #include "ash/wm/window_state_aura.h"
20 #include "ash/wm/window_util.h" 20 #include "ash/wm/window_util.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
22 #include "ui/aura/client/aura_constants.h" 23 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/test/test_window_delegate.h" 24 #include "ui/aura/test/test_window_delegate.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/aura/window_event_dispatcher.h" 26 #include "ui/aura/window_event_dispatcher.h"
26 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
27 #include "ui/display/manager/display_layout.h" 28 #include "ui/display/manager/display_layout.h"
28 #include "ui/display/manager/display_manager.h" 29 #include "ui/display/manager/display_manager.h"
29 #include "ui/display/screen.h" 30 #include "ui/display/screen.h"
30 #include "ui/display/test/display_manager_test_api.h" 31 #include "ui/display/test/display_manager_test_api.h"
31 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 EXPECT_EQ(ideal_width(), w1->bounds().width()); 575 EXPECT_EQ(ideal_width(), w1->bounds().width());
575 576
576 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300); 577 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300);
577 // The second window should get resized to the existing dock. 578 // The second window should get resized to the existing dock.
578 EXPECT_EQ(ideal_width(), w2->bounds().width()); 579 EXPECT_EQ(ideal_width(), w2->bounds().width());
579 } 580 }
580 581
581 // Tests that a first non-resizable window added to the dock is not resized. 582 // Tests that a first non-resizable window added to the dock is not resized.
582 TEST_P(DockedWindowLayoutManagerTest, TwoWindowsWidthNonResizableFirst) { 583 TEST_P(DockedWindowLayoutManagerTest, TwoWindowsWidthNonResizableFirst) {
583 std::unique_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 584 std::unique_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
584 w1->SetProperty(aura::client::kCanResizeKey, false); 585 w1->SetProperty(aura::client::kResizeBehaviorKey,
586 ui::mojom::kResizeBehaviorNone);
585 std::unique_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 280, 202))); 587 std::unique_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 280, 202)));
586 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); 588 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
587 // The first window should not get resized. 589 // The first window should not get resized.
588 EXPECT_EQ(201, w1->bounds().width()); 590 EXPECT_EQ(201, w1->bounds().width());
589 591
590 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300); 592 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300);
591 // The second window should get resized to the first window's width. 593 // The second window should get resized to the first window's width.
592 EXPECT_EQ(w1->bounds().width(), w2->bounds().width()); 594 EXPECT_EQ(w1->bounds().width(), w2->bounds().width());
593 } 595 }
594 596
595 // Tests that a second non-resizable window added to the dock is not resized. 597 // Tests that a second non-resizable window added to the dock is not resized.
596 TEST_P(DockedWindowLayoutManagerTest, TwoWindowsWidthNonResizableSecond) { 598 TEST_P(DockedWindowLayoutManagerTest, TwoWindowsWidthNonResizableSecond) {
597 std::unique_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201))); 599 std::unique_ptr<aura::Window> w1(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
598 std::unique_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 280, 202))); 600 std::unique_ptr<aura::Window> w2(CreateTestWindow(gfx::Rect(0, 0, 280, 202)));
599 w2->SetProperty(aura::client::kCanResizeKey, false); 601 w2->SetProperty(aura::client::kResizeBehaviorKey,
602 ui::mojom::kResizeBehaviorNone);
600 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20); 603 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w1.get(), 20);
601 // The first window should get resized to ideal width. 604 // The first window should get resized to ideal width.
602 EXPECT_EQ(ideal_width(), w1->bounds().width()); 605 EXPECT_EQ(ideal_width(), w1->bounds().width());
603 606
604 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300); 607 DragToVerticalPositionAndToEdge(DOCKED_EDGE_RIGHT, w2.get(), 300);
605 // The second window should not get resized. 608 // The second window should not get resized.
606 EXPECT_EQ(280, w2->bounds().width()); 609 EXPECT_EQ(280, w2->bounds().width());
607 610
608 // The first window should get resized again - to match the second window. 611 // The first window should get resized again - to match the second window.
609 EXPECT_EQ(w1->bounds().width(), w2->bounds().width()); 612 EXPECT_EQ(w1->bounds().width(), w2->bounds().width());
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); 798 EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height());
796 } 799 }
797 800
798 // Tests run twice - on both panels and normal windows 801 // Tests run twice - on both panels and normal windows
799 INSTANTIATE_TEST_CASE_P(NormalOrPanel, 802 INSTANTIATE_TEST_CASE_P(NormalOrPanel,
800 DockedWindowLayoutManagerTest, 803 DockedWindowLayoutManagerTest,
801 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 804 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
802 ui::wm::WINDOW_TYPE_PANEL)); 805 ui::wm::WINDOW_TYPE_PANEL));
803 806
804 } // namespace ash 807 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/ash_focus_rules_unittest.cc ('k') | ash/wm/lock_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698