Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: ui/wm/core/visibility_controller_unittest.cc

Issue 2020563006: [Merge to M51] Fix the issue that Apps window keeps moving down to the right when reopened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/wm/core/window_animations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/wm/core/visibility_controller.h" 5 #include "ui/wm/core/visibility_controller.h"
6 6
7 #include "ui/aura/test/aura_test_base.h" 7 #include "ui/aura/test/aura_test_base.h"
8 #include "ui/aura/test/test_window_delegate.h" 8 #include "ui/aura/test/test_window_delegate.h"
9 #include "ui/aura/test/test_windows.h" 9 #include "ui/aura/test/test_windows.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 IsAnimatingProperty(ui::LayerAnimationElement::OPACITY)); 47 IsAnimatingProperty(ui::LayerAnimationElement::OPACITY));
48 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity()); 48 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
49 49
50 // Check that the visibility is correct after the hide animation has finished. 50 // Check that the visibility is correct after the hide animation has finished.
51 window->Hide(); 51 window->Hide();
52 window->layer()->GetAnimator()->StopAnimating(); 52 window->layer()->GetAnimator()->StopAnimating();
53 EXPECT_FALSE(window->layer()->visible()); 53 EXPECT_FALSE(window->layer()->visible());
54 EXPECT_FALSE(window->IsVisible()); 54 EXPECT_FALSE(window->IsVisible());
55 } 55 }
56 56
57 // Check that a hiding animation would not change a window's bounds in screen.
58 TEST_F(VisibilityControllerTest, HideAnimationWindowBoundsTest) {
59 // We cannot disable animations for this test.
60 ui::ScopedAnimationDurationScaleMode test_duration_mode(
61 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
62
63 VisibilityController controller;
64 aura::client::SetVisibilityClient(root_window(), &controller);
65
66 // Set bound expectation.
67 gfx::Rect expected_bounds(4, 5, 123, 245);
68 aura::test::TestWindowDelegate d;
69 std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate(
70 &d, -2, expected_bounds, root_window()));
71 window->Show();
72 SetWindowVisibilityChangesAnimated(window.get());
73 SetWindowVisibilityAnimationDuration(window.get(),
74 base::TimeDelta::FromMilliseconds(5));
75 SetWindowVisibilityAnimationType(window.get(),
76 WINDOW_VISIBILITY_ANIMATION_TYPE_DROP);
77 // Check that the bound is correct after the hide animation has finished.
78 window->Hide();
79 window->layer()->GetAnimator()->StopAnimating();
80 EXPECT_EQ(expected_bounds, window->GetBoundsInScreen());
81 }
82
57 // Test if SetWindowVisibilityChagngesAnimated will animate the specified 83 // Test if SetWindowVisibilityChagngesAnimated will animate the specified
58 // window. 84 // window.
59 TEST_F(VisibilityControllerTest, SetWindowVisibilityChagnesAnimated) { 85 TEST_F(VisibilityControllerTest, SetWindowVisibilityChagnesAnimated) {
60 // We cannot disable animations for this test. 86 // We cannot disable animations for this test.
61 ui::ScopedAnimationDurationScaleMode test_duration_mode( 87 ui::ScopedAnimationDurationScaleMode test_duration_mode(
62 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); 88 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
63 89
64 VisibilityController controller; 90 VisibilityController controller;
65 aura::client::SetVisibilityClient(root_window(), &controller); 91 aura::client::SetVisibilityClient(root_window(), &controller);
66 92
(...skipping 14 matching lines...) Expand all
81 EXPECT_TRUE(window->layer()->GetAnimator()->is_animating()); 107 EXPECT_TRUE(window->layer()->GetAnimator()->is_animating());
82 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); 108 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
83 EXPECT_EQ(0.0f, window->layer()->opacity()); 109 EXPECT_EQ(0.0f, window->layer()->opacity());
84 110
85 window->layer()->GetAnimator()->StopAnimating(); 111 window->layer()->GetAnimator()->StopAnimating();
86 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity()); 112 EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
87 EXPECT_EQ(1.0f, window->layer()->opacity()); 113 EXPECT_EQ(1.0f, window->layer()->opacity());
88 } 114 }
89 115
90 } // namespace wm 116 } // namespace wm
OLDNEW
« no previous file with comments | « no previous file | ui/wm/core/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698