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

Unified Diff: ash/app_list/app_list_presenter_delegate_unittest.cc

Issue 2802903003: Implementation of a full screen app list and re-alphabetized switches (Closed)
Patch Set: Addressed comments, added my tests to the filter, and refactored! Created 3 years, 8 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 d554816c4b30abc599c2ef45436ad97f7e2baf9f..4bc0f6674a95e9a2daf22bd386a8a8fa7aba9081 100644
--- a/ash/app_list/app_list_presenter_delegate_unittest.cc
+++ b/ash/app_list/app_list_presenter_delegate_unittest.cc
@@ -4,6 +4,7 @@
#include <memory>
+#include "ash/ash_switches.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
@@ -11,7 +12,9 @@
#include "ash/test/test_app_list_view_presenter_impl.h"
#include "ash/wm/window_util.h"
#include "ash/wm_window.h"
+#include "base/command_line.h"
#include "base/macros.h"
+#include "ui/app_list/app_list_switches.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
@@ -28,7 +31,9 @@ int64_t GetPrimaryDisplayId() {
} // namespace
-class AppListPresenterDelegateTest : public test::AshTestBase {
+class AppListPresenterDelegateTest
+ : public test::AshTestBase,
+ public testing::WithParamInterface<bool> {
public:
AppListPresenterDelegateTest() {}
~AppListPresenterDelegateTest() override {}
@@ -41,18 +46,29 @@ class AppListPresenterDelegateTest : public test::AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
+ // If the current test is parameterized.
+ if (testing::UnitTest::GetInstance()->current_test_info()->value_param()){
+ test_with_fullscreen = GetParam();
+ if (test_with_fullscreen)
+ app_list::switches::SetFullscreenAppListSwitch();
+ }
// Make the display big enough to hold the app list.
UpdateDisplay("1024x768");
}
private:
test::TestAppListViewPresenterImpl app_list_presenter_impl_;
+ bool test_with_fullscreen;
vadimt 2017/04/20 20:21:34 add "_"
newcomer 2017/04/21 19:51:22 Done.
DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest);
};
+// Instantiate the Boolean which is used to toggle the Fullscreen app list in
+// the parameterized tests.
+INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool());
+
// Tests that app launcher hides when focus moves to a normal window.
-TEST_F(AppListPresenterDelegateTest, HideOnFocusOut) {
+TEST_P(AppListPresenterDelegateTest, HideOnFocusOut) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
@@ -64,7 +80,7 @@ TEST_F(AppListPresenterDelegateTest, HideOnFocusOut) {
// Tests that app launcher remains visible when focus is moved to a different
// window in kShellWindowId_AppListContainer.
-TEST_F(AppListPresenterDelegateTest,
+TEST_P(AppListPresenterDelegateTest,
RemainVisibleWhenFocusingToApplistContainer) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
EXPECT_TRUE(app_list_presenter_impl()->GetTargetVisibility());
@@ -79,7 +95,7 @@ TEST_F(AppListPresenterDelegateTest,
}
// Tests that clicking outside the app-list bubble closes it.
-TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) {
+TEST_P(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
aura::Window* app_window = app_list_presenter_impl()->GetWindow();
ASSERT_TRUE(app_window);
@@ -100,7 +116,7 @@ TEST_F(AppListPresenterDelegateTest, ClickOutsideBubbleClosesBubble) {
}
// Tests that clicking outside the app-list bubble closes it.
-TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) {
+TEST_P(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
aura::Window* app_window = app_list_presenter_impl()->GetWindow();
@@ -122,7 +138,7 @@ TEST_F(AppListPresenterDelegateTest, TapOutsideBubbleClosesBubble) {
// Tests opening the app launcher on a non-primary display, then deleting the
// display.
-TEST_F(AppListPresenterDelegateTest, NonPrimaryDisplay) {
+TEST_P(AppListPresenterDelegateTest, NonPrimaryDisplay) {
// Set up a screen with two displays (horizontally adjacent).
UpdateDisplay("1024x768,1024x768");
@@ -156,10 +172,12 @@ TEST_F(AppListPresenterDelegateTest, TinyDisplay) {
// 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 = app_list_presenter_impl()->GetView();
int app_list_view_top =
app_list->anchor_rect().y() - app_list->bounds().height() / 2;
const int kMinimalAppListMargin = 10;
+
EXPECT_GE(app_list_view_top, kMinimalAppListMargin);
}

Powered by Google App Engine
This is Rietveld 408576698