Commit 4ef381a6 authored by minch's avatar minch Committed by Chromium LUCI CQ

bento: Flip Bento feature to enabled by default

Bug: 1166374
Change-Id: I9e513de723c7d27cd12ac0bb7604c4ebbe5200b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628254Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845756}
parent 0446aec2
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "ash/display/window_tree_host_manager.h" #include "ash/display/window_tree_host_manager.h"
#include "ash/host/ash_window_tree_host.h" #include "ash/host/ash_window_tree_host.h"
#include "ash/magnifier/magnifier_test_utils.h" #include "ash/magnifier/magnifier_test_utils.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_pref_names.h"
#include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_config.h"
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
#include "ash/test/test_window_builder.h" #include "ash/test/test_window_builder.h"
#include "ash/wm/desks/desks_bar_view.h" #include "ash/wm/desks/desks_bar_view.h"
#include "ash/wm/desks/new_desk_button.h" #include "ash/wm/desks/new_desk_button.h"
#include "ash/wm/desks/zero_state_button.h"
#include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_grid.h"
#include "ash/wm/overview/overview_item.h" #include "ash/wm/overview/overview_item.h"
...@@ -508,13 +510,32 @@ TEST_F(DockedMagnifierTest, OverviewTabbing) { ...@@ -508,13 +510,32 @@ TEST_F(DockedMagnifierTest, OverviewTabbing) {
const auto* desk_bar_view = GetOverviewSession() const auto* desk_bar_view = GetOverviewSession()
->GetGridWithRootWindow(root_window) ->GetGridWithRootWindow(root_window)
->desks_bar_view(); ->desks_bar_view();
if (features::IsBentoEnabled()) {
// Tab once. The viewport should be centered on the center of the new desk ASSERT_TRUE(desk_bar_view->IsZeroState());
// button.
SendKey(ui::VKEY_TAB); // Tab once. The viewport should be centered on the center of the default
TestMagnifierLayerTransform( // desk button in the zero state desks bar.
desk_bar_view->new_desk_button()->GetBoundsInScreen().CenterPoint(), SendKey(ui::VKEY_TAB);
root_window); TestMagnifierLayerTransform(desk_bar_view->zero_state_default_desk_button()
->GetBoundsInScreen()
.CenterPoint(),
root_window);
// Tab one more time. The viewport should be centered on the center of the
// new desk button in the zero state desks bar.
SendKey(ui::VKEY_TAB);
TestMagnifierLayerTransform(desk_bar_view->zero_state_new_desk_button()
->GetBoundsInScreen()
.CenterPoint(),
root_window);
} else {
// Tab once. The viewport should be centered on the center of the new desk
// button.
SendKey(ui::VKEY_TAB);
TestMagnifierLayerTransform(
desk_bar_view->new_desk_button()->GetBoundsInScreen().CenterPoint(),
root_window);
}
// Tab one more time. The viewport should be centered on the beginning of the // Tab one more time. The viewport should be centered on the beginning of the
// overview item's title. // overview item's title.
......
...@@ -18,7 +18,7 @@ const base::Feature kAllowAmbientEQ{"AllowAmbientEQ", ...@@ -18,7 +18,7 @@ const base::Feature kAllowAmbientEQ{"AllowAmbientEQ",
const base::Feature kAutoNightLight{"AutoNightLight", const base::Feature kAutoNightLight{"AutoNightLight",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kBento{"Bento", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kBento{"Bento", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kCaptureMode{"CaptureMode", const base::Feature kCaptureMode{"CaptureMode",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "ash/public/cpp/ash_features.h" #include "ash/public/cpp/ash_features.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/desks/desks_controller.h" #include "ash/wm/desks/desks_controller.h"
#include "ash/wm/desks/desks_util.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
...@@ -68,7 +69,7 @@ TEST_F(AutotestDesksApiTest, ActivateDeskAtIndex) { ...@@ -68,7 +69,7 @@ TEST_F(AutotestDesksApiTest, ActivateDeskAtIndex) {
auto* controller = DesksController::Get(); auto* controller = DesksController::Get();
while (controller->CanCreateDesks()) while (controller->CanCreateDesks())
EXPECT_TRUE(test_api.CreateNewDesk()); EXPECT_TRUE(test_api.CreateNewDesk());
EXPECT_EQ(4u, controller->desks().size()); EXPECT_EQ(desks_util::GetMaxNumberOfDesks(), controller->desks().size());
constexpr int kIndices[] = {1, 2, 3, 0}; constexpr int kIndices[] = {1, 2, 3, 0};
for (const int index : kIndices) { for (const int index : kIndices) {
base::RunLoop run_loop; base::RunLoop run_loop;
...@@ -82,19 +83,18 @@ TEST_F(AutotestDesksApiTest, RemoveActiveDesk) { ...@@ -82,19 +83,18 @@ TEST_F(AutotestDesksApiTest, RemoveActiveDesk) {
AutotestDesksApi test_api; AutotestDesksApi test_api;
EXPECT_FALSE(test_api.RemoveActiveDesk(base::DoNothing())); EXPECT_FALSE(test_api.RemoveActiveDesk(base::DoNothing()));
const size_t max_number_of_desks = desks_util::GetMaxNumberOfDesks();
auto* controller = DesksController::Get(); auto* controller = DesksController::Get();
while (controller->CanCreateDesks()) while (controller->CanCreateDesks())
EXPECT_TRUE(test_api.CreateNewDesk()); EXPECT_TRUE(test_api.CreateNewDesk());
EXPECT_EQ(4u, controller->desks().size()); EXPECT_EQ(max_number_of_desks, controller->desks().size());
EXPECT_EQ(controller->active_desk(), controller->desks()[0].get()); EXPECT_EQ(controller->active_desk(), controller->desks()[0].get());
// List of desks that will be activated after each time we invoke // List of desks that will be activated after each time we invoke
// RemoveActiveDesk(). // RemoveActiveDesk().
const Desk* desks_after_removal[] = { std::vector<Desk*> desks_after_removal;
controller->desks()[1].get(), for (size_t i = 1; i < max_number_of_desks; i++)
controller->desks()[2].get(), desks_after_removal.push_back(controller->desks()[i].get());
controller->desks()[3].get(),
};
for (const Desk* desk : desks_after_removal) { for (const Desk* desk : desks_after_removal) {
base::RunLoop run_loop; base::RunLoop run_loop;
...@@ -131,19 +131,20 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest, ...@@ -131,19 +131,20 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest,
ActivateAdjacentDesksToTargetIndex) { ActivateAdjacentDesksToTargetIndex) {
// Create all desks possible. // Create all desks possible.
AutotestDesksApi test_api; AutotestDesksApi test_api;
const int max_number_of_desks = desks_util::GetMaxNumberOfDesks();
auto* controller = DesksController::Get(); auto* controller = DesksController::Get();
while (controller->CanCreateDesks()) while (controller->CanCreateDesks())
EXPECT_TRUE(test_api.CreateNewDesk()); EXPECT_TRUE(test_api.CreateNewDesk());
EXPECT_FALSE( EXPECT_FALSE(
test_api.ActivateAdjacentDesksToTargetIndex(-1, base::DoNothing())); test_api.ActivateAdjacentDesksToTargetIndex(-1, base::DoNothing()));
EXPECT_FALSE( EXPECT_FALSE(test_api.ActivateAdjacentDesksToTargetIndex(max_number_of_desks,
test_api.ActivateAdjacentDesksToTargetIndex(4, base::DoNothing())); base::DoNothing()));
// Activating already active desk does nothing. // Activating already active desk does nothing.
EXPECT_FALSE( EXPECT_FALSE(
test_api.ActivateAdjacentDesksToTargetIndex(0, base::DoNothing())); test_api.ActivateAdjacentDesksToTargetIndex(0, base::DoNothing()));
EXPECT_EQ(4u, controller->desks().size()); EXPECT_EQ(desks_util::GetMaxNumberOfDesks(), controller->desks().size());
// Replacing needs to be done while a current animation is underway, otherwise // Replacing needs to be done while a current animation is underway, otherwise
// it will have no effect. // it will have no effect.
...@@ -151,16 +152,17 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest, ...@@ -151,16 +152,17 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest,
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Activate the rightmost desk. Test that we end on that desk and that we // Activate the rightmost desk. Test that we end on that desk and that we
// observed 3 activation changes. // observed (max_number_of_desks - 1) activation changes.
TestDesksActivationObserver desk_activation_observer; TestDesksActivationObserver desk_activation_observer;
{ {
base::RunLoop run_loop; base::RunLoop run_loop;
EXPECT_TRUE( EXPECT_TRUE(test_api.ActivateAdjacentDesksToTargetIndex(
test_api.ActivateAdjacentDesksToTargetIndex(3, run_loop.QuitClosure())); max_number_of_desks - 1, run_loop.QuitClosure()));
run_loop.Run(); run_loop.Run();
} }
EXPECT_EQ(controller->active_desk(), controller->desks().back().get()); EXPECT_EQ(controller->active_desk(), controller->desks().back().get());
EXPECT_EQ(3, desk_activation_observer.activation_changes()); EXPECT_EQ(max_number_of_desks - 1,
desk_activation_observer.activation_changes());
// Activate the leftmost desk. Test that we end on that desk and that we // Activate the leftmost desk. Test that we end on that desk and that we
// observed 3 activation changes. // observed 3 activation changes.
...@@ -172,7 +174,8 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest, ...@@ -172,7 +174,8 @@ TEST_F(EnhancedDeskAnimationsAutotestDesksApiTest,
run_loop.Run(); run_loop.Run();
} }
EXPECT_EQ(controller->active_desk(), controller->desks().front().get()); EXPECT_EQ(controller->active_desk(), controller->desks().front().get());
EXPECT_EQ(3, desk_activation_observer.activation_changes()); EXPECT_EQ(max_number_of_desks - 1,
desk_activation_observer.activation_changes());
} }
} // namespace ash } // namespace ash
This diff is collapsed.
...@@ -48,6 +48,9 @@ DeskButtonBase::DeskButtonBase(const base::string16& text, ...@@ -48,6 +48,9 @@ DeskButtonBase::DeskButtonBase(const base::string16& text,
SetFocusPainter(nullptr); SetFocusPainter(nullptr);
SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY); SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY);
// TODO(minch): A11y of zero state.
SetAccessibleName(base::UTF8ToUTF16(GetClassName()));
auto border = std::make_unique<WmHighlightItemBorder>(border_corder_radius); auto border = std::make_unique<WmHighlightItemBorder>(border_corder_radius);
border_ptr_ = border.get(); border_ptr_ = border.get();
SetBorder(std::move(border)); SetBorder(std::move(border));
......
...@@ -44,6 +44,8 @@ class ASH_EXPORT DeskButtonBase ...@@ -44,6 +44,8 @@ class ASH_EXPORT DeskButtonBase
virtual void UpdateButtonState() {} virtual void UpdateButtonState() {}
SkColor GetBackgroundColorForTesting() const { return background_color_; }
protected: protected:
virtual void OnButtonPressed() = 0; virtual void OnButtonPressed() = 0;
......
...@@ -343,9 +343,9 @@ class DesksOverviewHighlightControllerTest ...@@ -343,9 +343,9 @@ class DesksOverviewHighlightControllerTest
DesksOverviewHighlightControllerTest() = default; DesksOverviewHighlightControllerTest() = default;
~DesksOverviewHighlightControllerTest() override = default; ~DesksOverviewHighlightControllerTest() override = default;
// AshTestBase: // OverviewHighlightControllerTest:
void SetUp() override { void SetUp() override {
AshTestBase::SetUp(); OverviewHighlightControllerTest::SetUp();
// All tests in this suite require the desks bar to be visible in overview, // All tests in this suite require the desks bar to be visible in overview,
// which requires at least two desks. // which requires at least two desks.
...@@ -362,8 +362,18 @@ class DesksOverviewHighlightControllerTest ...@@ -362,8 +362,18 @@ class DesksOverviewHighlightControllerTest
const DesksBarView* GetDesksBarViewForRoot(aura::Window* root_window) { const DesksBarView* GetDesksBarViewForRoot(aura::Window* root_window) {
OverviewGrid* grid = OverviewGrid* grid =
GetOverviewSession()->GetGridWithRootWindow(root_window); GetOverviewSession()->GetGridWithRootWindow(root_window);
DCHECK(grid->IsDesksBarViewActive()); const DesksBarView* bar_view = grid->desks_bar_view();
return grid->desks_bar_view(); DCHECK(bar_view->IsZeroState() ^ grid->IsDesksBarViewActive());
return bar_view;
}
OverviewHighlightController::OverviewHighlightableView* GetNewDeskButton(
const DesksBarView* bar_view) {
DCHECK(bar_view);
if (features::IsBentoEnabled())
return bar_view->expanded_state_new_desk_button()->new_desk_button();
return bar_view->new_desk_button();
} }
protected: protected:
...@@ -407,7 +417,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingBasic) { ...@@ -407,7 +417,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingBasic) {
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_EQ(desk_bar_view->new_desk_button(), GetHighlightedView()); EXPECT_EQ(GetNewDeskButton(desk_bar_view), GetHighlightedView());
CheckDeskBarViewSize(desk_bar_view, "new desk button"); CheckDeskBarViewSize(desk_bar_view, "new desk button");
// Tests that the overview item gets highlighted after the new desk button. // Tests that the overview item gets highlighted after the new desk button.
...@@ -445,7 +455,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingReverse) { ...@@ -445,7 +455,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingReverse) {
// the new desk button. // the new desk button.
SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN); SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN);
SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN); SendKey(ui::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_EQ(desk_bar_view->new_desk_button(), GetHighlightedView()); EXPECT_EQ(GetNewDeskButton(desk_bar_view), GetHighlightedView());
// Tests that after the new desk button comes the mini views and their desk // Tests that after the new desk button comes the mini views and their desk
// name views in reverse order. // name views in reverse order.
...@@ -502,7 +512,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) { ...@@ -502,7 +512,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) {
EXPECT_EQ(desk_bar_view1->mini_views()[1]->desk_name_view(), EXPECT_EQ(desk_bar_view1->mini_views()[1]->desk_name_view(),
GetHighlightedView()); GetHighlightedView());
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_EQ(desk_bar_view1->new_desk_button(), GetHighlightedView()); EXPECT_EQ(GetNewDeskButton(desk_bar_view1), GetHighlightedView());
// Tests that two more tabs, will highlight the two overview items on the // Tests that two more tabs, will highlight the two overview items on the
// first display. // first display.
...@@ -524,7 +534,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) { ...@@ -524,7 +534,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) {
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_EQ(desk_bar_view2->new_desk_button(), GetHighlightedView()); EXPECT_EQ(GetNewDeskButton(desk_bar_view2), GetHighlightedView());
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
auto* item3 = GetOverviewItemForWindow(window3.get()); auto* item3 = GetOverviewItemForWindow(window3.get());
EXPECT_EQ(item3->overview_item_view(), GetHighlightedView()); EXPECT_EQ(item3->overview_item_view(), GetHighlightedView());
...@@ -540,7 +550,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) { ...@@ -540,7 +550,7 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) {
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_EQ(desk_bar_view3->new_desk_button(), GetHighlightedView()); EXPECT_EQ(GetNewDeskButton(desk_bar_view3), GetHighlightedView());
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
auto* item4 = GetOverviewItemForWindow(window4.get()); auto* item4 = GetOverviewItemForWindow(window4.get());
EXPECT_EQ(item4->overview_item_view(), GetHighlightedView()); EXPECT_EQ(item4->overview_item_view(), GetHighlightedView());
...@@ -553,6 +563,10 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) { ...@@ -553,6 +563,10 @@ TEST_F(DesksOverviewHighlightControllerTest, TabbingMultiDisplay) {
TEST_F(DesksOverviewHighlightControllerTest, TEST_F(DesksOverviewHighlightControllerTest,
ActivateCloseHighlightOnNewDeskButton) { ActivateCloseHighlightOnNewDeskButton) {
// Tests the new desk button in classic desks.
if (features::IsBentoEnabled())
return;
ToggleOverview(); ToggleOverview();
const auto* desk_bar_view = const auto* desk_bar_view =
GetDesksBarViewForRoot(Shell::GetPrimaryRootWindow()); GetDesksBarViewForRoot(Shell::GetPrimaryRootWindow());
...@@ -638,45 +652,50 @@ TEST_F(DesksOverviewHighlightControllerTest, CloseHighlightOnMiniView) { ...@@ -638,45 +652,50 @@ TEST_F(DesksOverviewHighlightControllerTest, CloseHighlightOnMiniView) {
EXPECT_EQ(1u, desks_controller->desks().size()); EXPECT_EQ(1u, desks_controller->desks().size());
EXPECT_NE(desk2, desks_controller->desks()[0].get()); EXPECT_NE(desk2, desks_controller->desks()[0].get());
// Tests that hitting ctrl-w on the highlighted miniview if it is the last one if (features::IsBentoEnabled()) {
// does nothing. // Go back to zero state since there is only a single desk and mini views
while (mini_view1 != GetHighlightedView()) // are empty in zero state.
SendKey(ui::VKEY_TAB); EXPECT_TRUE(desk_bar_view->IsZeroState());
SendKey(ui::VKEY_W, ui::EF_CONTROL_DOWN); EXPECT_TRUE(desk_bar_view->mini_views().empty());
EXPECT_EQ(1u, desks_controller->desks().size()); } else {
// Tests that hitting ctrl-w on the highlighted miniview if it is the last
// one does nothing.
while (mini_view1 != GetHighlightedView())
SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_W, ui::EF_CONTROL_DOWN);
EXPECT_EQ(1u, desks_controller->desks().size());
}
} }
TEST_F(DesksOverviewHighlightControllerTest, ActivateDeskNameView) { TEST_F(DesksOverviewHighlightControllerTest, ActivateDeskNameView) {
ToggleOverview(); ToggleOverview();
const auto* desk_bar_view = const auto* desk_bar_view =
GetDesksBarViewForRoot(Shell::GetPrimaryRootWindow()); GetDesksBarViewForRoot(Shell::GetPrimaryRootWindow());
auto* desk_name_view_2 = desk_bar_view->mini_views()[1]->desk_name_view(); auto* desk_name_view_1 = desk_bar_view->mini_views()[0]->desk_name_view();
// Tab until the desk name view of the second desk is highlighted. // Tab until the desk name view of the first desk is highlighted.
SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
SendKey(ui::VKEY_TAB); EXPECT_EQ(desk_name_view_1, GetHighlightedView());
EXPECT_EQ(desk_name_view_2, GetHighlightedView());
// Press enter and expect that the desk name is being edited. // Press enter and expect that the desk name is being edited.
SendKey(ui::VKEY_RETURN); SendKey(ui::VKEY_RETURN);
EXPECT_TRUE(desk_name_view_2->HasFocus()); EXPECT_TRUE(desk_name_view_1->HasFocus());
EXPECT_TRUE(desk_bar_view->IsDeskNameBeingModified()); EXPECT_TRUE(desk_bar_view->IsDeskNameBeingModified());
// All should be selected. // All should be selected.
EXPECT_TRUE(desk_name_view_2->HasSelection()); EXPECT_TRUE(desk_name_view_1->HasSelection());
const auto* desks_controller = DesksController::Get(); const auto* desks_controller = DesksController::Get();
auto* desk_2 = desks_controller->desks()[1].get(); auto* desk_1 = desks_controller->desks()[0].get();
EXPECT_EQ(desk_2->name(), desk_name_view_2->GetSelectedText()); EXPECT_EQ(desk_1->name(), desk_name_view_1->GetSelectedText());
// Arrow keys should not change neither the focus nor the highlight. // Arrow keys should not change neither the focus nor the highlight.
SendKey(ui::VKEY_RIGHT); SendKey(ui::VKEY_RIGHT);
SendKey(ui::VKEY_RIGHT); SendKey(ui::VKEY_RIGHT);
SendKey(ui::VKEY_RIGHT); SendKey(ui::VKEY_RIGHT);
SendKey(ui::VKEY_LEFT); SendKey(ui::VKEY_LEFT);
EXPECT_EQ(desk_name_view_2, GetHighlightedView()); EXPECT_EQ(desk_name_view_1, GetHighlightedView());
EXPECT_TRUE(desk_name_view_2->HasFocus()); EXPECT_TRUE(desk_name_view_1->HasFocus());
// Select all and delete. // Select all and delete.
SendKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); SendKey(ui::VKEY_A, ui::EF_CONTROL_DOWN);
...@@ -689,10 +708,10 @@ TEST_F(DesksOverviewHighlightControllerTest, ActivateDeskNameView) { ...@@ -689,10 +708,10 @@ TEST_F(DesksOverviewHighlightControllerTest, ActivateDeskNameView) {
SendKey(ui::VKEY_E); SendKey(ui::VKEY_E);
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_FALSE(desk_name_view_2->HasFocus()); EXPECT_FALSE(desk_name_view_1->HasFocus());
EXPECT_EQ(desk_bar_view->new_desk_button(), GetHighlightedView()); EXPECT_EQ(desk_bar_view->mini_views()[1], GetHighlightedView());
EXPECT_EQ(base::UTF8ToUTF16("code"), desk_2->name()); EXPECT_EQ(base::UTF8ToUTF16("code"), desk_1->name());
EXPECT_TRUE(desk_2->is_name_set_by_user()); EXPECT_TRUE(desk_1->is_name_set_by_user());
} }
TEST_F(DesksOverviewHighlightControllerTest, RemoveDeskWhileNameIsHighlighted) { TEST_F(DesksOverviewHighlightControllerTest, RemoveDeskWhileNameIsHighlighted) {
...@@ -713,7 +732,13 @@ TEST_F(DesksOverviewHighlightControllerTest, RemoveDeskWhileNameIsHighlighted) { ...@@ -713,7 +732,13 @@ TEST_F(DesksOverviewHighlightControllerTest, RemoveDeskWhileNameIsHighlighted) {
// Tabbing again should cause no crashes. // Tabbing again should cause no crashes.
EXPECT_EQ(nullptr, GetHighlightedView()); EXPECT_EQ(nullptr, GetHighlightedView());
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
EXPECT_EQ(desk_bar_view->mini_views()[0], GetHighlightedView()); if (features::IsBentoEnabled()) {
EXPECT_TRUE(desk_bar_view->IsZeroState());
EXPECT_EQ(desk_bar_view->zero_state_default_desk_button(),
GetHighlightedView());
} else {
EXPECT_EQ(desk_bar_view->mini_views()[0], GetHighlightedView());
}
} }
// A test class for testing Bento features. // A test class for testing Bento features.
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/wm/overview/overview_test_util.h" #include "ash/wm/overview/overview_test_util.h"
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/overview_test_api.h" #include "ash/public/cpp/overview_test_api.h"
#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_config.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -42,8 +43,11 @@ void SendKey(ui::KeyboardCode key, int flags) { ...@@ -42,8 +43,11 @@ void SendKey(ui::KeyboardCode key, int flags) {
} }
bool HighlightOverviewWindow(const aura::Window* window) { bool HighlightOverviewWindow(const aura::Window* window) {
if (GetOverviewHighlightedWindow() == nullptr) if (GetOverviewHighlightedWindow() == nullptr) {
SendKey(ui::VKEY_TAB); SendKey(ui::VKEY_TAB);
if (features::IsBentoEnabled())
SendKey(ui::VKEY_TAB);
}
const aura::Window* start_window = GetOverviewHighlightedWindow(); const aura::Window* start_window = GetOverviewHighlightedWindow();
if (start_window == window) if (start_window == window)
return true; return true;
......
...@@ -234,7 +234,7 @@ class OverviewWindowDragControllerDesksPortraitTabletTest : public AshTestBase { ...@@ -234,7 +234,7 @@ class OverviewWindowDragControllerDesksPortraitTabletTest : public AshTestBase {
AshTestBase::SetUp(); AshTestBase::SetUp();
// Setup a portrait internal display in tablet mode. // Setup a portrait internal display in tablet mode.
UpdateDisplay("800x600"); UpdateDisplay("800x700");
const int64_t display_id = const int64_t display_id =
display::Screen::GetScreen()->GetPrimaryDisplay().id(); display::Screen::GetScreen()->GetPrimaryDisplay().id();
display::test::ScopedSetInternalDisplayId set_internal(display_manager(), display::test::ScopedSetInternalDisplayId set_internal(display_manager(),
......
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