diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc index 86d52075ca76f..d3dc52f0b678b 100644 --- a/ash/app_list/app_list_presenter_delegate_unittest.cc +++ b/ash/app_list/app_list_presenter_delegate_unittest.cc @@ -112,6 +112,11 @@ class AppListPresenterDelegateTest : public AshTestBase, app_list::AppListView::SetShortAnimationForTesting(true); AshTestBase::SetUp(); + // Zeros state changes expected UI behavior. Most test cases in this suite + // are the expected UI behavior with zero state being disabled. + // TODO(jennyz): Add new test cases for zero state, crbug.com/925195. + scoped_feature_list_.InitAndDisableFeature( + app_list_features::kEnableZeroStateSuggestions); // Make the display big enough to hold the app list. UpdateDisplay("1024x768"); } @@ -140,6 +145,8 @@ class AppListPresenterDelegateTest : public AshTestBase, } private: + base::test::ScopedFeatureList scoped_feature_list_; + DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest); }; diff --git a/ash/app_list/views/app_list_view_unittest.cc b/ash/app_list/views/app_list_view_unittest.cc index a65751435f4be..ddf9c36b2d436 100644 --- a/ash/app_list/views/app_list_view_unittest.cc +++ b/ash/app_list/views/app_list_view_unittest.cc @@ -38,6 +38,7 @@ #include "ash/app_list/views/test/apps_grid_view_test_api.h" #include "ash/public/cpp/app_list/app_list_config.h" #include "ash/public/cpp/app_list/app_list_constants.h" +#include "ash/public/cpp/app_list/app_list_features.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/strings/string_util.h" @@ -527,13 +528,14 @@ class AppListViewFocusTest : public views::ViewsTestBase, protected: bool is_rtl_ = false; + base::test::ScopedFeatureList scoped_feature_list_; private: AppListView* view_ = nullptr; // Owned by native widget. SearchResultContainerView* suggestions_container_ = nullptr; // Owned by view hierarchy. ExpandArrowView* expand_arrow_view_ = nullptr; // Owned by view hierarchy. - base::test::ScopedFeatureList scoped_feature_list_; + std::unique_ptr delegate_; std::unique_ptr test_api_; // Restores the locale to default when destructor is called. @@ -938,6 +940,14 @@ TEST_F(AppListViewFocusTest, FocusResetAfterStateTransition) { // Tests that key event which is not handled by focused view will be redirected // to search box. TEST_F(AppListViewFocusTest, RedirectFocusToSearchBox) { + // UI behavior is different with Zero State enabled. This test is + // the expected UI behavior with zero state feature being disabled. + // TODO(jennyz): Add new test case for UI behavior for zero state. + // crbug.com/925195. + scoped_feature_list_.InitAndDisableFeature( + app_list_features::kEnableZeroStateSuggestions); + EXPECT_FALSE(app_list_features::IsZeroStateSuggestionsEnabled()); + Show(); // Set focus to first suggestion app and type a character. @@ -947,6 +957,7 @@ TEST_F(AppListViewFocusTest, RedirectFocusToSearchBox) { EXPECT_EQ(search_box_view()->search_box()->text(), base::UTF8ToUTF16(" ")); EXPECT_FALSE(search_box_view()->search_box()->HasSelection()); + // UI and Focus behavior is different with Zero State enabled. // Set focus to expand arrow and type a character. expand_arrow_view()->RequestFocus(); SimulateKeyPress(ui::VKEY_A, false); diff --git a/ash/app_list/views/search_box_view_unittest.cc b/ash/app_list/views/search_box_view_unittest.cc index b32e3cefbccd6..84c4377da8d88 100644 --- a/ash/app_list/views/search_box_view_unittest.cc +++ b/ash/app_list/views/search_box_view_unittest.cc @@ -173,7 +173,12 @@ TEST_F(SearchBoxViewTest, CloseButtonVisibleAfterTyping) { // activated. TEST_F(SearchBoxViewTest, CloseButtonInvisibleAfterSearchBoxActived) { SetSearchBoxActive(true, ui::ET_MOUSE_PRESSED); - EXPECT_FALSE(view()->close_button()->visible()); + + // UI behavior is different with Zero State enabled. + if (app_list_features::IsZeroStateSuggestionsEnabled()) + EXPECT_TRUE(view()->close_button()->visible()); + else + EXPECT_FALSE(view()->close_button()->visible()); } // Tests that the close button becomes invisible after close button is clicked. @@ -302,8 +307,12 @@ TEST_F(SearchBoxViewAssistantButtonTest, AssistantButtonVisibleByDefault) { // Tests that the assistant button is visible after the search box is activated. TEST_F(SearchBoxViewAssistantButtonTest, AssistantButtonVisibleAfterSearchBoxActived) { - SetSearchBoxActive(true, ui::ET_MOUSE_PRESSED); - EXPECT_TRUE(view()->assistant_button()->visible()); + // Assistant button is not showing up under zero state for now. + // TODO(jennyz): Make assistant button show up under zero state. + if (!app_list_features::IsZeroStateSuggestionsEnabled()) { + SetSearchBoxActive(true, ui::ET_MOUSE_PRESSED); + EXPECT_TRUE(view()->assistant_button()->visible()); + } } // Tests that the assistant button is invisible after typing in the search box, @@ -313,8 +322,12 @@ TEST_F(SearchBoxViewAssistantButtonTest, KeyPress(ui::VKEY_A); EXPECT_FALSE(view()->assistant_button()->visible()); - KeyPress(ui::VKEY_BACK); - EXPECT_TRUE(view()->assistant_button()->visible()); + // Assistant button is not showing up under zero state for now. + // TODO(crbug.com/925455): Make assistant button show up under zero state. + if (!app_list_features::IsZeroStateSuggestionsEnabled()) { + KeyPress(ui::VKEY_BACK); + EXPECT_TRUE(view()->assistant_button()->visible()); + } } class SearchBoxViewAutocompleteTest diff --git a/ash/app_list/views/search_result_page_view_unittest.cc b/ash/app_list/views/search_result_page_view_unittest.cc index 334454246ea02..c2613e9c99cac 100644 --- a/ash/app_list/views/search_result_page_view_unittest.cc +++ b/ash/app_list/views/search_result_page_view_unittest.cc @@ -58,13 +58,20 @@ class SearchResultPageViewTest } // Setting up the feature set. - if (test_with_answer_card) - scoped_feature_list_.InitAndEnableFeature( - app_list_features::kEnableAnswerCard); - else - scoped_feature_list_.InitAndDisableFeature( - app_list_features::kEnableAnswerCard); + // Zero State will affect the UI behavior significantly. This test works + // if zero state feature is disabled. + // TODO(crbug.com/925195): Add different test suites for zero state. + if (test_with_answer_card) { + scoped_feature_list_.InitWithFeatures( + {app_list_features::kEnableAnswerCard}, + {app_list_features::kEnableZeroStateSuggestions}); + } else { + scoped_feature_list_.InitWithFeatures( + {}, {app_list_features::kEnableAnswerCard, + app_list_features::kEnableZeroStateSuggestions}); + } + ASSERT_FALSE(app_list_features::IsZeroStateSuggestionsEnabled()); ASSERT_EQ(test_with_answer_card, app_list_features::IsAnswerCardEnabled()); // Setting up views. diff --git a/ash/app_list/views/search_result_tile_item_list_view_unittest.cc b/ash/app_list/views/search_result_tile_item_list_view_unittest.cc index 99da7fc91e470..93297ac797dd3 100644 --- a/ash/app_list/views/search_result_tile_item_list_view_unittest.cc +++ b/ash/app_list/views/search_result_tile_item_list_view_unittest.cc @@ -41,12 +41,17 @@ class SearchResultTileItemListViewTest void CreateSearchResultTileItemListView() { // Enable fullscreen app list for parameterized Play Store app search // feature. + // Zero State affects the UI behavior significantly. This test tests the + // UI behavior with zero state being disable. + // TODO(crbug.com/925195): Write new test cases for zero state. if (IsPlayStoreAppSearchEnabled()) { scoped_feature_list_.InitWithFeatures( - {app_list_features::kEnablePlayStoreAppSearch}, {}); + {app_list_features::kEnablePlayStoreAppSearch}, + {app_list_features::kEnableZeroStateSuggestions}); } else { scoped_feature_list_.InitWithFeatures( - {}, {app_list_features::kEnablePlayStoreAppSearch}); + {}, {app_list_features::kEnablePlayStoreAppSearch, + app_list_features::kEnableZeroStateSuggestions}); } ASSERT_EQ(IsPlayStoreAppSearchEnabled(), app_list_features::IsPlayStoreAppSearchEnabled()); diff --git a/ash/public/cpp/app_list/app_list_features.cc b/ash/public/cpp/app_list/app_list_features.cc index 292e2104a3239..5cba0a42d0b39 100644 --- a/ash/public/cpp/app_list/app_list_features.cc +++ b/ash/public/cpp/app_list/app_list_features.cc @@ -27,7 +27,7 @@ const base::Feature kEnableSettingsShortcutSearch{ const base::Feature kEnableAppsGridGapFeature{"EnableAppsGridGapFeature", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kEnableZeroStateSuggestions{ - "EnableZeroStateSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; + "EnableZeroStateSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kEnableAppListSearchAutocomplete{ "EnableAppListSearchAutocomplete", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kEnableAppSearchResultRanker{ diff --git a/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc b/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc index 8b53762a553d0..8ef7969d506b6 100644 --- a/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc +++ b/chrome/browser/ui/app_list/app_list_client_impl_browsertest.cc @@ -4,6 +4,7 @@ #include +#include "ash/public/cpp/app_list/app_list_features.h" #include "ash/public/cpp/app_list/app_list_switches.h" #include "base/command_line.h" #include "base/macros.h" @@ -11,6 +12,7 @@ #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind_test_util.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/apps/platform_apps/app_browsertest_util.h" #include "chrome/browser/browser_process.h" @@ -200,6 +202,14 @@ using AppListClientSearchResultsBrowserTest = extensions::ExtensionBrowserTest; // Test showing search results, and uninstalling one of them while displayed. IN_PROC_BROWSER_TEST_F(AppListClientSearchResultsBrowserTest, UninstallSearchResult) { + // Zero state changes UI behavior. This test case tests the expected UI + // behavior with zero state being disabled. + // TODO(jennyz): write new test case for zero state, crbug.com/925195. + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndDisableFeature( + app_list_features::kEnableZeroStateSuggestions); + ASSERT_FALSE(app_list_features::IsZeroStateSuggestionsEnabled()); + base::FilePath test_extension_path; ASSERT_TRUE( base::PathService::Get(chrome::DIR_TEST_DATA, &test_extension_path));