1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37

ash / wm / overlay_layout_manager_unittest.cc [blame]

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/overlay_layout_manager.h"

#include <memory>

#include "ash/public/cpp/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/widget/widget.h"

namespace ash {
namespace {

using OverlayLayoutManagerTest = AshTestBase;

// Verifies that a fullscreen widget in the overlay container has its bounds
// updated when the display rotates. https://crbug.com/869130
TEST_F(OverlayLayoutManagerTest, FullscreenWidgetWithDisplayRotation) {
  UpdateDisplay("800x600");

  // Create a fullscreen widget in the overlay container.
  std::unique_ptr<views::Widget> widget =
      CreateTestWidget(views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET,
                       nullptr, kShellWindowId_OverlayContainer);
  widget->SetFullscreen(true);
  EXPECT_EQ(gfx::Rect(0, 0, 800, 600), widget->GetWindowBoundsInScreen());

  // Widget bounds update after display rotation.
  UpdateDisplay("800x600/r");
  EXPECT_EQ(gfx::Rect(0, 0, 600, 800), widget->GetWindowBoundsInScreen());
}

}  // namespace
}  // namespace ash