Commit 26c94dbd authored by Vladislav Kaznacheev's avatar Vladislav Kaznacheev Committed by Commit Bot

Do not skip virtual desks tests when kShelfHotseat is disabled

Tests in OverviewWindowDragControllerDesksPortraitTabletTest used to
return early if kShelfHotseat feature is enabled by default.

This CL makes this test suite parametrized and runs is with
kShelfHotseat enabled and disabled. Enabled branch still
returns early, but disabled runs normally.

Bug: 1011128
Test: OverviewWindowDragControllerDesksPortraitTabletTest
Change-Id: Ic705435207bb26c8dd98f8debad0960ec25c339c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871733Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Auto-Submit: Vladislav Kaznacheev <kaznacheev@chromium.org>
Commit-Queue: Vladislav Kaznacheev <kaznacheev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707885}
parent 5214e811
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chromeos/constants/chromeos_switches.h" #include "chromeos/constants/chromeos_features.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/display/test/display_manager_test_api.h" #include "ui/display/test/display_manager_test_api.h"
#include "ui/events/test/event_generator.h" #include "ui/events/test/event_generator.h"
...@@ -301,7 +301,8 @@ TEST_F(OverviewWindowDragControllerWithDesksTest, ...@@ -301,7 +301,8 @@ TEST_F(OverviewWindowDragControllerWithDesksTest,
// Tests the behavior of dragging a window in portrait tablet mode with virtual // Tests the behavior of dragging a window in portrait tablet mode with virtual
// desks enabled. // desks enabled.
class OverviewWindowDragControllerDesksPortraitTabletTest class OverviewWindowDragControllerDesksPortraitTabletTest
: public OverviewWindowDragControllerWithDesksTest { : public AshTestBase,
public testing::WithParamInterface<bool> {
public: public:
OverviewWindowDragControllerDesksPortraitTabletTest() = default; OverviewWindowDragControllerDesksPortraitTabletTest() = default;
~OverviewWindowDragControllerDesksPortraitTabletTest() override = default; ~OverviewWindowDragControllerDesksPortraitTabletTest() override = default;
...@@ -337,9 +338,24 @@ class OverviewWindowDragControllerDesksPortraitTabletTest ...@@ -337,9 +338,24 @@ class OverviewWindowDragControllerDesksPortraitTabletTest
return overview_grid()->desks_bar_view()->GetWidget(); return overview_grid()->desks_bar_view()->GetWidget();
} }
bool IsHotseatEnabled() { return GetParam(); }
// OverviewWindowDragControllerWithDesksTest: // OverviewWindowDragControllerWithDesksTest:
void SetUp() override { void SetUp() override {
OverviewWindowDragControllerWithDesksTest::SetUp(); if (IsHotseatEnabled()) {
scoped_feature_list_.InitWithFeatures(
/* enabled */ {features::kVirtualDesks,
chromeos::features::kShelfScrollable,
chromeos::features::kShelfHotseat},
/* disabled */ {});
} else {
scoped_feature_list_.InitWithFeatures(
/* enabled */ {features::kVirtualDesks},
/* disabled */ {chromeos::features::kShelfScrollable,
chromeos::features::kShelfHotseat});
}
AshTestBase::SetUp();
// Setup a portrait internal display in tablet mode. // Setup a portrait internal display in tablet mode.
UpdateDisplay("800x600"); UpdateDisplay("800x600");
...@@ -396,13 +412,15 @@ class OverviewWindowDragControllerDesksPortraitTabletTest ...@@ -396,13 +412,15 @@ class OverviewWindowDragControllerDesksPortraitTabletTest
} }
private: private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragControllerDesksPortraitTabletTest); DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragControllerDesksPortraitTabletTest);
}; };
TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest,
DragAndDropInEmptyArea) { DragAndDropInEmptyArea) {
// TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled. // TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled.
if (chromeos::switches::ShouldShowShelfHotseat()) if (IsHotseatEnabled())
return; return;
auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100));
...@@ -417,10 +435,10 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, ...@@ -417,10 +435,10 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest,
EXPECT_EQ(0, desks_bar_widget()->GetWindowBoundsInScreen().y()); EXPECT_EQ(0, desks_bar_widget()->GetWindowBoundsInScreen().y());
} }
TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest,
DragAndDropInSnapAreas) { DragAndDropInSnapAreas) {
// TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled. // TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled.
if (chromeos::switches::ShouldShowShelfHotseat()) if (IsHotseatEnabled())
return; return;
auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100));
...@@ -464,9 +482,9 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, ...@@ -464,9 +482,9 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest,
desks_bar_widget()->GetWindowBoundsInScreen().y()); desks_bar_widget()->GetWindowBoundsInScreen().y());
} }
TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) { TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) {
// TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled. // TODO(https://crbug.com/1011128): Fix this test when the hotseat is enabled.
if (chromeos::switches::ShouldShowShelfHotseat()) if (IsHotseatEnabled())
return; return;
auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100));
...@@ -501,4 +519,8 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) { ...@@ -501,4 +519,8 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) {
drag_indicators()->current_indicator_state()); drag_indicators()->current_indicator_state());
} }
INSTANTIATE_TEST_SUITE_P(,
OverviewWindowDragControllerDesksPortraitTabletTest,
testing::Bool());
} // namespace ash } // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment