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

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

Issue 2402643004: Moves most of WorkspaceLayoutManagerTest into ash/common (Closed)
Patch Set: feedback Created 4 years, 2 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/common/BUILD.gn ('k') | ash/mus/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/workspace/workspace_layout_manager_unittest.cc
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
similarity index 92%
copy from ash/wm/workspace/workspace_layout_manager_unittest.cc
copy to ash/common/wm/workspace/workspace_layout_manager_unittest.cc
index 623aa84e74d8bcfc2ec7f9885f415e18a2175470..fa4fb1bcaa015bb8af9d3249cebbe6611868ca97 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager_unittest.cc
@@ -7,7 +7,6 @@
#include <string>
#include <utility>
-#include "ash/aura/wm_window_aura.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/shelf_layout_manager.h"
@@ -25,28 +24,15 @@
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
#include "ash/common/wm_shell.h"
-#include "ash/display/display_manager.h"
-#include "ash/root_window_controller.h"
-#include "ash/screen_util.h"
-#include "ash/shell.h"
-#include "ash/test/ash_test_base.h"
-#include "ash/test/display_manager_test_api.h"
-#include "ash/wm/window_state_aura.h"
-#include "ash/wm/window_util.h"
#include "base/command_line.h"
-#include "base/compiler_specific.h"
#include "base/run_loop.h"
#include "ui/base/ui_base_switches.h"
#include "ui/base/ui_base_types.h"
-#include "ui/display/manager/display_layout.h"
+#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/insets.h"
-#include "ui/keyboard/keyboard_controller.h"
-#include "ui/keyboard/keyboard_ui.h"
-#include "ui/keyboard/keyboard_util.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
-#include "ui/wm/core/window_util.h"
namespace ash {
namespace {
@@ -1229,104 +1215,4 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, IgnoreKeyboardBoundsChange) {
EXPECT_EQ(keyboard_bounds(), window->GetBounds());
}
-TEST_F(WorkspaceLayoutManagerKeyboardTest, ChangeWorkAreaInNonStickyMode) {
- keyboard::SetAccessibilityKeyboardEnabled(true);
- InitKeyboardBounds();
- Shell::GetInstance()->CreateKeyboard();
- keyboard::KeyboardController* kb_controller =
- keyboard::KeyboardController::GetInstance();
-
- gfx::Rect work_area(
- display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
-
- gfx::Rect orig_window_bounds(0, 100, work_area.width(),
- work_area.height() - 100);
- std::unique_ptr<WindowOwner> window_owner(
- CreateToplevelTestWindow(orig_window_bounds));
- WmWindow* window = window_owner->window();
-
- window->Activate();
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-
- // Open keyboard in non-sticky mode.
- kb_controller->ShowKeyboard(false);
- kb_controller->ui()->GetKeyboardWindow()->SetBounds(
- keyboard::FullWidthKeyboardBoundsFromRootBounds(
- WmShell::Get()->GetPrimaryRootWindow()->GetBounds(), 100));
-
- int shift =
- work_area.height() - kb_controller->GetContainerWindow()->bounds().y();
- gfx::Rect changed_window_bounds(orig_window_bounds);
- changed_window_bounds.Offset(0, -shift);
- // Window should be shifted up.
- EXPECT_EQ(changed_window_bounds, window->GetBounds());
-
- kb_controller->HideKeyboard(
- keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-
- // Open keyboard in sticky mode.
- kb_controller->ShowKeyboard(true);
-
- // Window should be shifted up.
- EXPECT_EQ(changed_window_bounds, window->GetBounds());
-
- kb_controller->HideKeyboard(
- keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-}
-
-// When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility
-// keyboard work area in non-sticky mode.
-TEST_F(WorkspaceLayoutManagerKeyboardTest,
- IgnoreWorkAreaChangeinNonStickyMode) {
- // Append flag to ignore work area change in non-sticky mode.
- EnableNewVKMode();
-
- keyboard::SetAccessibilityKeyboardEnabled(true);
- InitKeyboardBounds();
- Shell::GetInstance()->CreateKeyboard();
- keyboard::KeyboardController* kb_controller =
- keyboard::KeyboardController::GetInstance();
-
- gfx::Rect work_area(
- display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
-
- gfx::Rect orig_window_bounds(0, 100, work_area.width(),
- work_area.height() - 100);
- std::unique_ptr<WindowOwner> window_owner(
- CreateToplevelTestWindow(orig_window_bounds));
- WmWindow* window = window_owner->window();
-
- window->Activate();
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-
- // Open keyboard in non-sticky mode.
- kb_controller->ShowKeyboard(false);
- kb_controller->ui()->GetKeyboardWindow()->SetBounds(
- keyboard::FullWidthKeyboardBoundsFromRootBounds(
- WmShell::Get()->GetPrimaryRootWindow()->GetBounds(), 100));
-
- // Window should not be shifted up.
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-
- kb_controller->HideKeyboard(
- keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-
- // Open keyboard in sticky mode.
- kb_controller->ShowKeyboard(true);
-
- int shift =
- work_area.height() - kb_controller->GetContainerWindow()->bounds().y();
- gfx::Rect changed_window_bounds(orig_window_bounds);
- changed_window_bounds.Offset(0, -shift);
- // Window should be shifted up.
- EXPECT_EQ(changed_window_bounds, window->GetBounds());
-
- kb_controller->HideKeyboard(
- keyboard::KeyboardController::HIDE_REASON_AUTOMATIC);
- EXPECT_EQ(orig_window_bounds, window->GetBounds());
-}
-
} // namespace ash
« no previous file with comments | « ash/common/BUILD.gn ('k') | ash/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698