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

Unified Diff: ash/app_list/app_list_presenter_delegate_unittest.cc

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Created 3 years, 7 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
Index: ash/app_list/app_list_presenter_delegate_unittest.cc
diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc
index ecc32aa14c30297dd036f86e44bb026d3c4222fc..88f27222b8e6a2a81bea8d93685a8381725b4ae2 100644
--- a/ash/app_list/app_list_presenter_delegate_unittest.cc
+++ b/ash/app_list/app_list_presenter_delegate_unittest.cc
@@ -15,6 +15,8 @@
#include "base/macros.h"
#include "base/test/scoped_feature_list.h"
#include "ui/app_list/app_list_features.h"
+#include "ui/app_list/app_list_switches.h"
+#include "ui/app_list/views/app_list_main_view.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
@@ -55,12 +57,12 @@ class AppListPresenterDelegateTest : public test::AshTestBase,
UpdateDisplay("1024x768");
}
- private:
void EnableFullscreenAppList() {
scoped_feature_list_.InitAndEnableFeature(
app_list::features::kEnableFullscreenAppList);
}
+ private:
test::TestAppListViewPresenterImpl app_list_presenter_impl_;
bool test_with_fullscreen_;
base::test::ScopedFeatureList scoped_feature_list_;
@@ -187,4 +189,61 @@ TEST_F(AppListPresenterDelegateTest, TinyDisplay) {
EXPECT_GE(app_list_view_top, kMinimalAppListMargin);
}
+// Tests that the peeking launcher is enlarged to fullscreen after the user
+// types in the search box.
+TEST_P(AppListPresenterDelegateTest, SnapToFullscreenAfterSearchboxInput) {
+ if(!app_list::features::IsFullscreenAppListEnabled())
xiyuan 2017/05/24 18:28:17 If the test case does not run for non-fullscreen,
newcomer 2017/05/25 23:10:50 Done! I was experimenting with tests and left that
+ return;
+ //EnableFullscreenAppList();
vadimt 2017/05/22 23:36:56 Remove/uncomment?
newcomer 2017/05/25 23:10:50 Done.
+ UpdateDisplay("1024x768");
+ EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled());
+ app_list_presenter_impl()->Show(GetPrimaryDisplayId());
+ app_list::AppListView* app_list = app_list_presenter_impl()->GetView();
+ // check that it is in peeking mode
+ EXPECT_FALSE(app_list->IsFullscreen());
+
+ // dummy key event to search box
+ ui::test::EventGenerator& generator = GetEventGenerator();
+ generator.PressKey(ui::KeyboardCode::VKEY_0, 0);
+ // check that it is in fullscreen mode
+ EXPECT_TRUE(app_list->IsFullscreen());
+}
+
+// Tests that the peeking launcher closes if the user taps outside it's
+// bounds.
+TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingLauncher) {
+ EnableFullscreenAppList();
+
+ app_list_presenter_impl()->Show(GetPrimaryDisplayId());
+ ui::test::EventGenerator& generator = GetEventGenerator();
+ // Grab the bounds of the search box,
xiyuan 2017/05/24 18:28:17 nit: insert an empty line before
newcomer 2017/05/25 23:10:50 Done.
+ // which is guarunteed to be inside the launcher.
xiyuan 2017/05/24 18:28:17 nit: guarunteed -> guaranteed
newcomer 2017/05/25 23:10:50 Done.
+ gfx::Rect search_box_bounds = app_list_presenter_impl()
+ ->GetView()
+ ->search_box_widget()
+ ->GetContentsView()
+ ->GetBoundsInScreen();
+ gfx::Point tap_point = search_box_bounds.CenterPoint();
+ // Tapping inside the bounds doesn't close the launcher.
xiyuan 2017/05/24 18:28:17 nit: insert an empty line before.
newcomer 2017/05/25 23:10:50 Done.
+ generator.GestureTapAt(tap_point);
+ EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
+ // Clicking inside the bounds doesn't close the launcher.
xiyuan 2017/05/24 18:28:17 nit: insert an empty line before.
newcomer 2017/05/25 23:10:50 Done.
+ generator.MoveMouseTo(tap_point);
+ generator.ClickLeftButton();
+ EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
+
+ // Tapping outside the bounds closes the launcher.
+ tap_point.set_x(tap_point.x() + 750);
+ generator.GestureTapAt(tap_point);
+ EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
+
+ app_list_presenter_impl()->Show(GetPrimaryDisplayId());
+ EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
+
+ // Clicking outside the bounds closes the launcher.
+ generator.MoveMouseTo(tap_point);
+ generator.ClickLeftButton();
+ EXPECT_FALSE(app_list_presenter_impl()->GetTargetVisibility());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698