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

Unified Diff: ash/wm/splitview/split_view_controller_unittest.cc

Issue 2955203002: Cros Tablet Window management - Split Screen part II (Closed)
Patch Set: Rebase. Created 3 years, 6 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
Index: ash/wm/splitview/split_view_controller_unittest.cc
diff --git a/ash/wm/splitview/split_view_controller_unittest.cc b/ash/wm/splitview/split_view_controller_unittest.cc
index d35c3588bf34ef9c1f20026d30e637254e38d449..d13f111c48fbaeb0bd41a4bc1b9b49045787a554 100644
--- a/ash/wm/splitview/split_view_controller_unittest.cc
+++ b/ash/wm/splitview/split_view_controller_unittest.cc
@@ -6,6 +6,7 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "ash/wm/wm_event.h"
@@ -26,6 +27,16 @@ class SplitViewControllerTest : public test::AshTestBase {
void EndSplitView() { split_view_controller()->EndSplitView(); }
+ void ToggleOverview() {
+ Shell::Get()->window_selector_controller()->ToggleOverview();
+ }
+
+ std::vector<aura::Window*> GetWindowsInOverviewGrids() {
+ return Shell::Get()
+ ->window_selector_controller()
+ ->GetWindowsListInOverviewGridsForTesting();
+ }
+
SplitViewController* split_view_controller() {
return Shell::Get()->split_view_controller();
}
@@ -104,7 +115,7 @@ TEST_F(SplitViewControllerTest, EndSplitViewUponWindowClose) {
// Tests that if one of the snapped window gets minimized / maximized / full-
// screened, end the split view mode.
TEST_F(SplitViewControllerTest, WindowStateChangeTest) {
- const gfx::Rect bounds(0, 0, 400, 400);
oshima 2017/06/29 17:46:23 why this change?
xdai1 2017/07/06 00:35:49 Sorry, it was a mistake. Bring it back.
+ gfx::Rect bounds(0, 0, 400, 400);
std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
EXPECT_EQ(split_view_controller()->IsSplitViewModeActive(), false);
@@ -156,4 +167,52 @@ TEST_F(SplitViewControllerTest, WindowActivationTest) {
SplitViewController::BOTH_SNAPPED);
}
+// Tests that if split view mode and overview mode are active at the same time,
+// i.e., half of the screen is occupied by a snapped window and half of the
+// screen is occupied by the overview windows grid, the next activatable window
+// will be picked to snap when exiting the overview mode.
+TEST_F(SplitViewControllerTest, ExitOverviewTest) {
+ const gfx::Rect bounds(0, 0, 400, 400);
+ std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
+ std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
+ std::unique_ptr<aura::Window> window3(CreateWindow(bounds));
+ EXPECT_EQ(split_view_controller()->IsSplitViewModeActive(), false);
+
+ ToggleOverview();
+ split_view_controller()->SetLeftWindow(window1.get());
+ EXPECT_EQ(split_view_controller()->IsSplitViewModeActive(), true);
+ EXPECT_EQ(split_view_controller()->state(),
+ SplitViewController::LEFT_SNAPPED);
+ EXPECT_EQ(split_view_controller()->left_window(), window1.get());
+
+ ToggleOverview();
+ EXPECT_EQ(split_view_controller()->state(),
+ SplitViewController::BOTH_SNAPPED);
+ EXPECT_EQ(split_view_controller()->right_window(), window3.get());
+}
+
+// Tests that if split view mode is active when entering overview, the overview
+// windows grid should show in the non-default side of the screen, and the
+// default snapped window should not be shown in the overview window grid.
+TEST_F(SplitViewControllerTest, EnterOverviewTest) {
+ const gfx::Rect bounds(0, 0, 400, 400);
+ std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
+ std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
+ std::unique_ptr<aura::Window> window3(CreateWindow(bounds));
+
+ split_view_controller()->SetLeftWindow(window1.get());
+ split_view_controller()->SetRightWindow(window2.get());
+ EXPECT_EQ(split_view_controller()->state(),
+ SplitViewController::BOTH_SNAPPED);
+ EXPECT_EQ(split_view_controller()->GetDefaultSnappedWindow(), window1.get());
+
+ ToggleOverview();
+ EXPECT_EQ(split_view_controller()->state(),
+ SplitViewController::LEFT_SNAPPED);
+ std::vector<aura::Window*> windows = GetWindowsInOverviewGrids();
+ auto iter = std::find(windows.begin(), windows.end(),
+ split_view_controller()->GetDefaultSnappedWindow());
+ EXPECT_TRUE(iter == windows.end());
+}
+
} // namespace ash
« ash/wm/overview/window_selector_item.cc ('K') | « ash/wm/overview/window_selector_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698