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

Unified Diff: ui/app_list/views/app_list_view_unittest.cc

Issue 945373002: Refocus app list search box when dialogs are closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add_Test Created 5 years, 10 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
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698