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
3 // found in the LICENSE file.
6 #include "ash/shell_window_ids.h"
7 #include "ash/test/ash_test_base.h"
8 #include "ash/test/test_shell_delegate.h"
9 #include "ash/wm/window_util.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/aura/test/test_windows.h"
12 #include "ui/aura/window.h"
16 typedef test::AshTestBase AppListControllerTest
;
18 // Tests that app launcher hides when focus moves to a normal window.
19 TEST_F(AppListControllerTest
, HideOnFocusOut
) {
20 Shell::GetInstance()->ToggleAppList(NULL
);
21 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
23 scoped_ptr
<aura::Window
> window(CreateTestWindowInShellWithId(0));
24 wm::ActivateWindow(window
.get());
26 EXPECT_FALSE(Shell::GetInstance()->GetAppListTargetVisibility());
29 // Tests that app launcher remains visible when focus is moved to a different
30 // window in kShellWindowId_AppListContainer.
31 TEST_F(AppListControllerTest
, RemainVisibleWhenFocusingToApplistContainer
) {
32 Shell::GetInstance()->ToggleAppList(NULL
);
33 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
35 aura::Window
* applist_container
= Shell::GetContainer(
36 Shell::GetPrimaryRootWindow(),
37 internal::kShellWindowId_AppListContainer
);
38 scoped_ptr
<aura::Window
> window(
39 aura::test::CreateTestWindowWithId(0, applist_container
));
40 wm::ActivateWindow(window
.get());
42 EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());