| Index: ash/wm/window_positioner_unittest.cc
|
| diff --git a/ash/wm/window_positioner_unittest.cc b/ash/wm/window_positioner_unittest.cc
|
| index af320bc209fe4bb0d8cdf86aca9e6fa20b098555..79f9a84a6fef1017fee77c2693cf2748e23e88d0 100644
|
| --- a/ash/wm/window_positioner_unittest.cc
|
| +++ b/ash/wm/window_positioner_unittest.cc
|
| @@ -4,11 +4,15 @@
|
|
|
| #include "ash/wm/window_positioner.h"
|
|
|
| +#include <string>
|
| +
|
| #include "ash/shell.h"
|
| #include "ash/shell/toplevel_window.h"
|
| #include "ash/test/ash_test_base.h"
|
| +#include "ash/test/test_shell_delegate.h"
|
| #include "ash/wm/window_positioner.h"
|
| #include "ash/wm/window_state.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| #include "ui/gfx/screen.h"
|
| #include "ui/views/widget/widget.h"
|
| @@ -146,4 +150,49 @@ TEST_F(WindowPositionerTest, EnsureMinimumVisibility) {
|
| widget->CloseNow();
|
| }
|
|
|
| +// In general case on first run the browser window will be maximized only for
|
| +// low resolution screens (width < 1366). In case of big screens the browser is
|
| +// opened being not maximized. To enforce maximization for all screen
|
| +// resolutions, one can set "ForceMaximizeBrowserWindowOnFirstRun"
|
| +// policy. In the following tests we check if the window will be opened in
|
| +// maximized mode for low and high resolution when this policy is set.
|
| +TEST_F(WindowPositionerTest, FirstRunMaximizeWindowHighResloution) {
|
| + const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() + 100;
|
| + // Set resolution to 1466x300.
|
| + const std::string resolution = base::IntToString(width) + "x300";
|
| + UpdateDisplay(resolution);
|
| + gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
|
| + ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
|
| +
|
| + test::TestShellDelegate* const delegate =
|
| + static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
|
| + delegate->SetForceMaximizeOnFirstRun(true);
|
| +
|
| + WindowPositioner::GetBoundsAndShowStateForNewWindow(
|
| + Shell::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT,
|
| + &bounds_in_out, &show_state_out);
|
| +
|
| + EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
|
| +}
|
| +
|
| +// For detail see description of FirstRunMaximizeWindowHighResloution.
|
| +TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) {
|
| + const int width = ash::WindowPositioner::GetForceMaximizedWidthLimit() - 100;
|
| + // Set resolution to 1266x300.
|
| + const std::string resolution = base::IntToString(width) + "x300";
|
| + UpdateDisplay(resolution);
|
| + gfx::Rect bounds_in_out(0, 0, 320, 240); // Random bounds.
|
| + ui::WindowShowState show_state_out = ui::SHOW_STATE_DEFAULT;
|
| +
|
| + test::TestShellDelegate* const delegate =
|
| + static_cast<test::TestShellDelegate*>(Shell::GetInstance()->delegate());
|
| + delegate->SetForceMaximizeOnFirstRun(true);
|
| +
|
| + WindowPositioner::GetBoundsAndShowStateForNewWindow(
|
| + Shell::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT,
|
| + &bounds_in_out, &show_state_out);
|
| +
|
| + EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED);
|
| +}
|
| +
|
| } // namespace
|
|
|