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

Side by Side Diff: ash/wm/window_positioner_unittest.cc

Issue 2653593004: chromeos: Remove AshTestBase::SupportsMultipleDisplays (Closed)
Patch Set: Created 3 years, 11 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/window_cycle_controller_unittest.cc ('k') | ash/wm/window_state_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/window_positioner.h" 5 #include "ash/common/wm/window_positioner.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/scoped_root_window_for_new_windows.h" 10 #include "ash/common/scoped_root_window_for_new_windows.h"
(...skipping 16 matching lines...) Expand all
27 using WindowPositionerTest = test::AshMDTestBase; 27 using WindowPositionerTest = test::AshMDTestBase;
28 28
29 INSTANTIATE_TEST_CASE_P( 29 INSTANTIATE_TEST_CASE_P(
30 /* prefix intentionally left blank due to only one parameterization */, 30 /* prefix intentionally left blank due to only one parameterization */,
31 WindowPositionerTest, 31 WindowPositionerTest,
32 testing::Values(MaterialDesignController::NON_MATERIAL, 32 testing::Values(MaterialDesignController::NON_MATERIAL,
33 MaterialDesignController::MATERIAL_NORMAL, 33 MaterialDesignController::MATERIAL_NORMAL,
34 MaterialDesignController::MATERIAL_EXPERIMENTAL)); 34 MaterialDesignController::MATERIAL_EXPERIMENTAL));
35 35
36 TEST_P(WindowPositionerTest, OpenMaximizedWindowOnSecondDisplay) { 36 TEST_P(WindowPositionerTest, OpenMaximizedWindowOnSecondDisplay) {
37 if (!SupportsMultipleDisplays())
38 return;
39 const int height_offset = GetMdMaximizedWindowHeightOffset(); 37 const int height_offset = GetMdMaximizedWindowHeightOffset();
40 // Tests that for a screen that is narrower than kForceMaximizeWidthLimit 38 // Tests that for a screen that is narrower than kForceMaximizeWidthLimit
41 // a new window gets maximized. 39 // a new window gets maximized.
42 UpdateDisplay("400x400,500x500"); 40 UpdateDisplay("400x400,500x500");
43 ScopedRootWindowForNewWindows root_for_new_windows( 41 ScopedRootWindowForNewWindows root_for_new_windows(
44 WmShell::Get()->GetAllRootWindows()[1]); 42 WmShell::Get()->GetAllRootWindows()[1]);
45 shell::ToplevelWindow::CreateParams params; 43 shell::ToplevelWindow::CreateParams params;
46 params.can_resize = true; 44 params.can_resize = true;
47 params.can_maximize = true; 45 params.can_maximize = true;
48 views::Widget* widget = shell::ToplevelWindow::CreateToplevelWindow(params); 46 views::Widget* widget = shell::ToplevelWindow::CreateToplevelWindow(params);
49 EXPECT_EQ(gfx::Rect(400, 0, 500, 453 + height_offset).ToString(), 47 EXPECT_EQ(gfx::Rect(400, 0, 500, 453 + height_offset).ToString(),
50 widget->GetWindowBoundsInScreen().ToString()); 48 widget->GetWindowBoundsInScreen().ToString());
51 } 49 }
52 50
53 TEST_P(WindowPositionerTest, OpenDefaultWindowOnSecondDisplay) { 51 TEST_P(WindowPositionerTest, OpenDefaultWindowOnSecondDisplay) {
54 if (!SupportsMultipleDisplays())
55 return;
56
57 UpdateDisplay("400x400,1400x900"); 52 UpdateDisplay("400x400,1400x900");
58 WmWindow* second_root_window = WmShell::Get()->GetAllRootWindows()[1]; 53 WmWindow* second_root_window = WmShell::Get()->GetAllRootWindows()[1];
59 ScopedRootWindowForNewWindows root_for_new_windows(second_root_window); 54 ScopedRootWindowForNewWindows root_for_new_windows(second_root_window);
60 shell::ToplevelWindow::CreateParams params; 55 shell::ToplevelWindow::CreateParams params;
61 params.can_resize = true; 56 params.can_resize = true;
62 params.can_maximize = true; 57 params.can_maximize = true;
63 views::Widget* widget = shell::ToplevelWindow::CreateToplevelWindow(params); 58 views::Widget* widget = shell::ToplevelWindow::CreateToplevelWindow(params);
64 gfx::Rect bounds = widget->GetWindowBoundsInScreen(); 59 gfx::Rect bounds = widget->GetWindowBoundsInScreen();
65 60
66 // The window should be in the 2nd display with the default size. 61 // The window should be in the 2nd display with the default size.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 widget1->SetFullscreen(false); 214 widget1->SetFullscreen(false);
220 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 215 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
221 216
222 // Closing 2nd widget triggers the rearrange logic but the 1st 217 // Closing 2nd widget triggers the rearrange logic but the 1st
223 // widget should stay in the current size. 218 // widget should stay in the current size.
224 widget2->CloseNow(); 219 widget2->CloseNow();
225 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString()); 220 ASSERT_EQ("300x300", widget1->GetWindowBoundsInScreen().size().ToString());
226 } 221 }
227 222
228 } // namespace ash 223 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_cycle_controller_unittest.cc ('k') | ash/wm/window_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698