OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "ash/wm/session_state_animator_impl.h" |
| 6 |
5 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
6 #include "ash/shell.h" | 8 #include "ash/shell.h" |
7 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
8 #include "ash/wm/session_state_animator.h" | 10 #include "ash/wm/session_state_animator.h" |
9 #include "ash/wm/session_state_animator_impl.h" | 11 #include "base/bind.h" |
| 12 #include "base/run_loop.h" |
10 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
11 | 14 |
12 typedef ash::test::AshTestBase SessionStateAnimatiorImplContainersTest; | 15 typedef ash::test::AshTestBase SessionStateAnimatiorImplContainersTest; |
13 | 16 |
14 namespace ash { | 17 namespace ash { |
15 namespace { | 18 namespace { |
16 | 19 |
17 bool ParentHasWindowWithId(const aura::Window* window, int id) { | 20 bool ParentHasWindowWithId(const aura::Window* window, int id) { |
18 return window->parent()->id() == id; | 21 return window->parent()->id() == id; |
19 } | 22 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 SessionStateAnimatorImpl::GetContainers( | 76 SessionStateAnimatorImpl::GetContainers( |
74 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS, &containers); | 77 SessionStateAnimator::LOCK_SCREEN_RELATED_CONTAINERS, &containers); |
75 EXPECT_TRUE(ContainersHaveWindowWithId( | 78 EXPECT_TRUE(ContainersHaveWindowWithId( |
76 containers, kShellWindowId_LockScreenRelatedContainersContainer)); | 79 containers, kShellWindowId_LockScreenRelatedContainersContainer)); |
77 | 80 |
78 // Empty mask should clear the container. | 81 // Empty mask should clear the container. |
79 SessionStateAnimatorImpl::GetContainers(0, &containers); | 82 SessionStateAnimatorImpl::GetContainers(0, &containers); |
80 EXPECT_TRUE(containers.empty()); | 83 EXPECT_TRUE(containers.empty()); |
81 } | 84 } |
82 | 85 |
| 86 // Test that SessionStateAnimatorImpl invokes the callback only once on |
| 87 // multi-display env, where it needs to run multiple animations on multiple |
| 88 // containers. See http://crbug.com/712422 for details. |
| 89 TEST_F(SessionStateAnimatiorImplContainersTest, |
| 90 AnimationCallbackOnMultiDisplay) { |
| 91 UpdateDisplay("200x200,400x400"); |
| 92 |
| 93 int callback_count = 0; |
| 94 SessionStateAnimatorImpl animator; |
| 95 animator.StartAnimationWithCallback( |
| 96 SessionStateAnimator::LOCK_SCREEN_CONTAINERS, |
| 97 SessionStateAnimator::ANIMATION_LIFT, |
| 98 SessionStateAnimator::ANIMATION_SPEED_IMMEDIATE, |
| 99 base::Bind([](int* count) { ++(*count); }, &callback_count)); |
| 100 base::RunLoop().RunUntilIdle(); |
| 101 EXPECT_EQ(1, callback_count); |
| 102 } |
| 103 |
83 } // namespace ash | 104 } // namespace ash |
OLD | NEW |