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

Unified Diff: ash/wm/app_list_controller_unittest.cc

Issue 281523002: ChromeOS: The centered app list's top is now forced to be >= 10. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« ash/wm/app_list_controller.cc ('K') | « ash/wm/app_list_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/app_list_controller_unittest.cc
diff --git a/ash/wm/app_list_controller_unittest.cc b/ash/wm/app_list_controller_unittest.cc
index 7b467dfabfe39fe960a74b4e92e60a2b2a29d556..90df0a8c1dca3a0378da382a67b86812d3f14b0a 100644
--- a/ash/wm/app_list_controller_unittest.cc
+++ b/ash/wm/app_list_controller_unittest.cc
@@ -10,12 +10,19 @@
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "ui/app_list/app_list_switches.h"
+#include "ui/app_list/views/app_list_view.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
namespace ash {
+namespace {
+
+const int kMinimalCenteredAppListMargin = 10;
+
+}
+
// The parameter is true to test the centered app list, false for normal.
// (The test name ends in "/0" for normal, "/1" for centered.)
class AppListControllerTest : public test::AshTestBase,
@@ -137,6 +144,33 @@ TEST_P(AppListControllerTest, NonPrimaryDisplay) {
EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility());
}
+// Tests opening the app launcher on a tiny display that is too small to contain
+// it.
+TEST_P(AppListControllerTest, TinyDisplay) {
Matt Giuca 2014/05/12 06:34:23 Note: This test fails without CL 283443003 because
varkha 2014/05/13 03:25:31 (Should this test and maybe other tests be disable
Matt Giuca 2014/05/13 04:02:12 Why? This test doesn't use window resizing, it jus
varkha 2014/05/13 04:40:11 Unfortunately this call is a NOP on platforms that
Matt Giuca 2014/05/13 05:31:58 Fair enough. Done.
+ // Don't test this for the non-centered app list case; it isn't designed for
+ // small displays. The most common case of a small display --- when the
+ // virtual keyboard is open --- switches into the centered app list mode, so
+ // we just want to run this test in that case.
+ if (!GetParam())
varkha 2014/05/13 03:25:31 Can we wrap this in a self-descriptive method (boo
Matt Giuca 2014/05/13 04:02:12 Done.
+ return;
+
+ // Set up a screen with a tiny display (height smaller than the app list).
+ UpdateDisplay("400x300");
+
+ Shell::GetInstance()->ToggleAppList(NULL);
+ EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // The top of the app list should be on-screen (even if the bottom is not).
+ // We need to manually calculate the Y coordinate of the top of the app list
+ // from the anchor (center) and height. There isn't a bounds rect that gives
+ // the actual app list position (the widget bounds include the bubble border
+ // which is much bigger than the actual app list size).
+ app_list::AppListView* app_list = Shell::GetInstance()->GetAppListView();
+ int app_list_view_top =
+ app_list->anchor_rect().y() - app_list->bounds().height() / 2;
+ EXPECT_GE(app_list_view_top, kMinimalCenteredAppListMargin);
+}
+
INSTANTIATE_TEST_CASE_P(AppListControllerTestInstance,
AppListControllerTest,
::testing::Bool());
« ash/wm/app_list_controller.cc ('K') | « ash/wm/app_list_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698