Update V8 to version 4.7.21.
[chromium-blink-merge.git] / ash / wm / session_state_animator_impl_unittest.cc
blob25a8bacd69913e0a07694d5ce7f0c03ddc29c3f9
1 // Copyright 2015 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.
5 #include "ash/shell.h"
6 #include "ash/shell_window_ids.h"
7 #include "ash/test/ash_test_base.h"
8 #include "ash/wm/session_state_animator.h"
9 #include "ash/wm/session_state_animator_impl.h"
10 #include "ui/aura/client/aura_constants.h"
12 typedef ash::test::AshTestBase SessionStateAnimatiorImplContainersTest;
14 namespace ash {
15 namespace {
17 bool ParentHasWindowWithId(const aura::Window* window, int id) {
18 return window->parent()->id() == id;
21 bool ContainersHaveWindowWithId(const aura::Window::Windows windows, int id) {
22 for (const aura::Window* window : windows) {
23 if (window->id() == id)
24 return true;
26 return false;
29 } // namespace
31 TEST_F(SessionStateAnimatiorImplContainersTest, ContainersHaveIdTest) {
32 aura::Window::Windows containers;
34 // Test ROOT_CONTAINER mask.
35 aura::Window* root_window = Shell::GetPrimaryRootWindow();
36 SessionStateAnimatorImpl::GetContainers(SessionStateAnimator::ROOT_CONTAINER,
37 &containers);
38 EXPECT_EQ(root_window, containers[0]);
40 containers.clear();
42 SessionStateAnimatorImpl::GetContainers(
43 SessionStateAnimator::DESKTOP_BACKGROUND, &containers);
44 EXPECT_TRUE(ContainersHaveWindowWithId(
45 containers, kShellWindowId_DesktopBackgroundContainer));
47 containers.clear();
49 // Check for shelf in launcher.
50 SessionStateAnimatorImpl::GetContainers(SessionStateAnimator::LAUNCHER,
51 &containers);
52 EXPECT_TRUE(
53 ContainersHaveWindowWithId(containers, kShellWindowId_ShelfContainer));
55 containers.clear();
57 SessionStateAnimatorImpl::GetContainers(
58 SessionStateAnimator::NON_LOCK_SCREEN_CONTAINERS, &containers);
59 EXPECT_TRUE(ParentHasWindowWithId(
60 containers[0], kShellWindowId_NonLockScreenContainersContainer));
62 containers.clear();
64 // Check for lock screen containers.
65 SessionStateAnimatorImpl::GetContainers(
66 SessionStateAnimator::LOCK_SCREEN_BACKGROUND, &containers);
67 EXPECT_TRUE(ContainersHaveWindowWithId(
68 containers, kShellWindowId_LockScreenBackgroundContainer));
70 containers.clear();
72 // Check for the lock screen containers container.
73 SessionStateAnimatorImpl::GetContainers(
74 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS, &containers);
75 EXPECT_TRUE(ContainersHaveWindowWithId(
76 containers, kShellWindowId_LockScreenRelatedContainersContainer));
78 // Empty mask should clear the container.
79 SessionStateAnimatorImpl::GetContainers(0, &containers);
80 EXPECT_TRUE(containers.empty());
83 } // namespace ash