Index: ui/app_list/views/app_list_view_unittest.cc |
diff --git a/ui/app_list/views/app_list_view_unittest.cc b/ui/app_list/views/app_list_view_unittest.cc |
index 81dc2cf4154555274c5fed261988487b8de4ea0b..ded35430852b5ba3594e5eda20cce8f8b53e6ded 100644 |
--- a/ui/app_list/views/app_list_view_unittest.cc |
+++ b/ui/app_list/views/app_list_view_unittest.cc |
@@ -111,6 +111,9 @@ class AppListViewTestContext { |
// Tests displaying of the search results. |
void RunSearchResultsTest(); |
+ // Tests displaying the app list overlay. |
+ void RunAppListOverlayTest(); |
+ |
// A standard set of checks on a view, e.g., ensuring it is drawn and visible. |
static void CheckView(views::View* subview); |
@@ -666,6 +669,25 @@ void AppListViewTestContext::RunSearchResultsTest() { |
Close(); |
} |
+void AppListViewTestContext::RunAppListOverlayTest() { |
+ Show(); |
+ |
+ AppListMainView* main_view = view_->app_list_main_view(); |
+ SearchBoxView* search_box_view = main_view->search_box_view(); |
+ |
+ // The search box should not be enabled when the app list overlay is shown. |
+ view_->SetAppListOverlayVisible(true); |
+ EXPECT_FALSE(search_box_view->enabled()); |
+ |
+ // The search box should be refocused when the app list overlay is hidden. |
+ view_->SetAppListOverlayVisible(false); |
+ EXPECT_TRUE(search_box_view->enabled()); |
+ EXPECT_EQ(search_box_view->search_box(), |
+ view_->GetWidget()->GetFocusManager()->GetFocusedView()); |
+ |
+ Close(); |
+} |
+ |
class AppListViewTestAura : public views::ViewsTestBase, |
public ::testing::WithParamInterface<int> { |
public: |
@@ -825,6 +847,15 @@ TEST_P(AppListViewTestDesktop, BackTest) { |
EXPECT_NO_FATAL_FAILURE(test_context_->RunBackTest()); |
} |
+// Tests that the correct views are displayed for showing search results. |
+TEST_P(AppListViewTestAura, AppListOverlayTest) { |
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest()); |
+} |
+ |
+TEST_P(AppListViewTestDesktop, AppListOverlayTest) { |
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest()); |
+} |
+ |
#if defined(USE_AURA) |
INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, |
AppListViewTestAura, |