| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <memory> |
| 6 |
| 5 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 6 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 7 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 8 #include "ash/test/test_shell_delegate.h" | 10 #include "ash/test/test_shell_delegate.h" |
| 9 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "ui/app_list/app_list_switches.h" | 13 #include "ui/app_list/app_list_switches.h" |
| 13 #include "ui/app_list/views/app_list_view.h" | 14 #include "ui/app_list/views/app_list_view.h" |
| 14 #include "ui/aura/test/test_windows.h" | 15 #include "ui/aura/test/test_windows.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/events/test/event_generator.h" | 17 #include "ui/events/test/event_generator.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 55 |
| 55 bool AppListControllerTest::IsCentered() const { | 56 bool AppListControllerTest::IsCentered() const { |
| 56 return GetParam(); | 57 return GetParam(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 // Tests that app launcher hides when focus moves to a normal window. | 60 // Tests that app launcher hides when focus moves to a normal window. |
| 60 TEST_P(AppListControllerTest, HideOnFocusOut) { | 61 TEST_P(AppListControllerTest, HideOnFocusOut) { |
| 61 Shell::GetInstance()->ShowAppList(NULL); | 62 Shell::GetInstance()->ShowAppList(NULL); |
| 62 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); | 63 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 63 | 64 |
| 64 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 65 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 65 wm::ActivateWindow(window.get()); | 66 wm::ActivateWindow(window.get()); |
| 66 | 67 |
| 67 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); | 68 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 // Tests that app launcher remains visible when focus is moved to a different | 71 // Tests that app launcher remains visible when focus is moved to a different |
| 71 // window in kShellWindowId_AppListContainer. | 72 // window in kShellWindowId_AppListContainer. |
| 72 TEST_P(AppListControllerTest, RemainVisibleWhenFocusingToApplistContainer) { | 73 TEST_P(AppListControllerTest, RemainVisibleWhenFocusingToApplistContainer) { |
| 73 Shell::GetInstance()->ShowAppList(NULL); | 74 Shell::GetInstance()->ShowAppList(NULL); |
| 74 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); | 75 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 75 | 76 |
| 76 aura::Window* applist_container = Shell::GetContainer( | 77 aura::Window* applist_container = Shell::GetContainer( |
| 77 Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer); | 78 Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer); |
| 78 scoped_ptr<aura::Window> window( | 79 std::unique_ptr<aura::Window> window( |
| 79 aura::test::CreateTestWindowWithId(0, applist_container)); | 80 aura::test::CreateTestWindowWithId(0, applist_container)); |
| 80 wm::ActivateWindow(window.get()); | 81 wm::ActivateWindow(window.get()); |
| 81 | 82 |
| 82 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); | 83 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility()); |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Tests that clicking outside the app-list bubble closes it. | 86 // Tests that clicking outside the app-list bubble closes it. |
| 86 TEST_P(AppListControllerTest, ClickOutsideBubbleClosesBubble) { | 87 TEST_P(AppListControllerTest, ClickOutsideBubbleClosesBubble) { |
| 87 Shell* shell = Shell::GetInstance(); | 88 Shell* shell = Shell::GetInstance(); |
| 88 shell->ShowAppList(NULL); | 89 shell->ShowAppList(NULL); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 int app_list_view_top = | 183 int app_list_view_top = |
| 183 app_list->anchor_rect().y() - app_list->bounds().height() / 2; | 184 app_list->anchor_rect().y() - app_list->bounds().height() / 2; |
| 184 EXPECT_GE(app_list_view_top, kMinimalCenteredAppListMargin); | 185 EXPECT_GE(app_list_view_top, kMinimalCenteredAppListMargin); |
| 185 } | 186 } |
| 186 | 187 |
| 187 INSTANTIATE_TEST_CASE_P(AppListControllerTestInstance, | 188 INSTANTIATE_TEST_CASE_P(AppListControllerTestInstance, |
| 188 AppListControllerTest, | 189 AppListControllerTest, |
| 189 ::testing::Bool()); | 190 ::testing::Bool()); |
| 190 | 191 |
| 191 } // namespace ash | 192 } // namespace ash |
| OLD | NEW |