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

Unified Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 2901663003: chromeos: converts WindowState to aura::Window (Closed)
Patch Set: feedback Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 827e86c30bb8650117c62d6396e580b1050e02f4..dad250beb9f252233a69eb8b23f85519388c7942 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -8,6 +8,7 @@
#include <utility>
#include "ash/accessibility_delegate.h"
+#include "ash/frame/custom_frame_view_ash.h"
#include "ash/public/cpp/config.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
@@ -25,7 +26,6 @@
#include "ash/test/shell_test_api.h"
#include "ash/test/test_accessibility_delegate.h"
#include "ash/test/test_session_controller_client.h"
-#include "ash/test/wm_window_test_api.h"
#include "ash/test/workspace_controller_test_api.h"
#include "ash/wm/fullscreen_window_finder.h"
#include "ash/wm/maximize_mode/maximize_mode_backdrop_delegate_impl.h"
@@ -59,10 +59,6 @@
#include "ui/views/widget/widget_delegate.h"
#include "ui/wm/core/window_util.h"
-// NOTE: many of these tests use GlobalMinimumSizeLock. This is needed as the
-// tests assume a minimum size of 0x0. In mash the minimum size, for top-level
-// windows, is not 0x0, so without this the tests fails.
-
namespace ash {
namespace {
@@ -122,6 +118,23 @@ void DisableNewVKMode() {
} // namespace
+// NOTE: many of these tests use CustomFrameViewAshSizeLock. This is needed as
+// the tests assume a minimum size of 0x0. In mash the minimum size, for
+// top-level windows, is not 0x0, so without this the tests fails.
+// TODO(sky): update the tests so that this isn't necessary.
+class CustomFrameViewAshSizeLock {
+ public:
+ CustomFrameViewAshSizeLock() {
+ CustomFrameViewAsh::use_empty_minimum_size_for_test_ = true;
+ }
+ ~CustomFrameViewAshSizeLock() {
+ CustomFrameViewAsh::use_empty_minimum_size_for_test_ = false;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAshSizeLock);
+};
+
using WorkspaceLayoutManagerTest = test::AshTestBase;
// Verifies that a window containing a restore coordinate will be restored to
@@ -129,7 +142,7 @@ using WorkspaceLayoutManagerTest = test::AshTestBase;
// there is one).
TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) {
// See comment at top of file for why this is needed.
- WmWindowTestApi::GlobalMinimumSizeLock min_size_lock;
+ CustomFrameViewAshSizeLock min_size_lock;
std::unique_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(1, 2, 3, 4)));
gfx::Rect bounds(10, 15, 25, 35);
window->SetBounds(bounds);
@@ -199,7 +212,7 @@ TEST_F(WorkspaceLayoutManagerTest, NoMinimumVisibilityForPopupWindows) {
TEST_F(WorkspaceLayoutManagerTest, KeepRestoredWindowInDisplay) {
// See comment at top of file for why this is needed.
- WmWindowTestApi::GlobalMinimumSizeLock min_size_lock;
+ CustomFrameViewAshSizeLock min_size_lock;
std::unique_ptr<aura::Window> window(
CreateTestWindow(gfx::Rect(1, 2, 30, 40)));
wm::WindowState* window_state = wm::GetWindowState(window.get());
@@ -239,6 +252,8 @@ TEST_F(WorkspaceLayoutManagerTest, KeepRestoredWindowInDisplay) {
}
TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) {
+ // See comment at top of file for why this is needed.
+ CustomFrameViewAshSizeLock min_size_lock;
UpdateDisplay("300x400,400x500");
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
@@ -291,6 +306,8 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) {
}
TEST_F(WorkspaceLayoutManagerTest, FullscreenInDisplayToBeRestored) {
+ // See comment at top of file for why this is needed.
+ CustomFrameViewAshSizeLock min_size_lock;
UpdateDisplay("300x400,400x500");
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
@@ -1425,7 +1442,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) {
DisableNewVKMode();
// See comment at top of file for why this is needed.
- WmWindowTestApi::GlobalMinimumSizeLock min_size_lock;
+ CustomFrameViewAshSizeLock min_size_lock;
InitKeyboardBounds();
@@ -1460,7 +1477,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) {
DisableNewVKMode();
// See comment at top of file for why this is needed.
- WmWindowTestApi::GlobalMinimumSizeLock min_size_lock;
+ CustomFrameViewAshSizeLock min_size_lock;
InitKeyboardBounds();
gfx::Rect work_area(
display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698