This source file includes following definitions.
- TEST_F
- TEST_F
- TEST_F
- TEST_F
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/test_shell_delegate.h"
#include "ash/wm/window_util.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
namespace ash {
typedef test::AshTestBase AppListControllerTest;
TEST_F(AppListControllerTest, HideOnFocusOut) {
Shell::GetInstance()->ToggleAppList(NULL);
EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
wm::ActivateWindow(window.get());
EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility());
}
TEST_F(AppListControllerTest, RemainVisibleWhenFocusingToApplistContainer) {
Shell::GetInstance()->ToggleAppList(NULL);
EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
aura::Window* applist_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer);
scoped_ptr<aura::Window> window(
aura::test::CreateTestWindowWithId(0, applist_container));
wm::ActivateWindow(window.get());
EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
}
TEST_F(AppListControllerTest, ClickOutsideBubbleClosesBubble) {
Shell* shell = Shell::GetInstance();
shell->ToggleAppList(NULL);
aura::Window* app_window = shell->GetAppListWindow();
ASSERT_TRUE(app_window);
aura::test::EventGenerator generator(shell->GetPrimaryRootWindow(),
app_window);
generator.ClickLeftButton();
EXPECT_TRUE(shell->GetAppListTargetVisibility());
gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
gfx::Point point_outside =
gfx::Point(app_window_bounds.right(), app_window_bounds.y()) +
gfx::Vector2d(10, 0);
EXPECT_TRUE(shell->GetPrimaryRootWindow()->bounds().Contains(point_outside));
generator.MoveMouseToInHost(point_outside);
generator.ClickLeftButton();
EXPECT_FALSE(shell->GetAppListTargetVisibility());
}
TEST_F(AppListControllerTest, TapOutsideBubbleClosesBubble) {
Shell* shell = Shell::GetInstance();
shell->ToggleAppList(NULL);
aura::Window* app_window = shell->GetAppListWindow();
ASSERT_TRUE(app_window);
gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
aura::test::EventGenerator generator(shell->GetPrimaryRootWindow());
generator.GestureTapAt(app_window_bounds.CenterPoint());
EXPECT_TRUE(shell->GetAppListTargetVisibility());
gfx::Point point_outside =
gfx::Point(app_window_bounds.right(), app_window_bounds.y()) +
gfx::Vector2d(10, 0);
EXPECT_TRUE(shell->GetPrimaryRootWindow()->bounds().Contains(point_outside));
generator.GestureTapAt(point_outside);
EXPECT_FALSE(shell->GetAppListTargetVisibility());
}
}