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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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 | « ui/wm/core/visibility_controller.cc ('k') | ui/wm/core/window_animations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/wm/core/visibility_controller.h"
6
7 #include "ui/aura/test/aura_test_base.h"
8 #include "ui/aura/test/test_window_delegate.h"
9 #include "ui/aura/test/test_windows.h"
10 #include "ui/aura/window.h"
11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/compositor/layer.h"
13 #include "ui/compositor/layer_animator.h"
14 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
15 #include "ui/compositor/scoped_layer_animation_settings.h"
16
17 namespace wm {
18
19 typedef aura::test::AuraTestBase VisibilityControllerTest;
20
21 // Check that a transparency change to 0 will not cause a hide call to be
22 // ignored.
23 TEST_F(VisibilityControllerTest, AnimateTransparencyToZeroAndHideHides) {
24 // We cannot disable animations for this test.
25 ui::ScopedAnimationDurationScaleMode test_duration_mode(
26 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
27
28 VisibilityController controller;
29 aura::client::SetVisibilityClient(root_window(), &controller);
30
31 SetChildWindowVisibilityChangesAnimated(root_window());
32
33 aura::test::TestWindowDelegate d;
34 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate(
35 &d, -2, gfx::Rect(0, 0, 50, 50), root_window()));
36 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
37 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(5));
38
39 EXPECT_TRUE(window->layer()->visible());
40 EXPECT_TRUE(window->IsVisible());
41
42 window->layer()->SetOpacity(0.0);
43 EXPECT_TRUE(window->layer()->visible());
44 EXPECT_TRUE(window->IsVisible());
45 EXPECT_TRUE(window->layer()->GetAnimator()->
46 IsAnimatingProperty(ui::LayerAnimationElement::OPACITY));
47 EXPECT_EQ(0.0f, window->layer()->GetTargetOpacity());
48
49 // Check that the visibility is correct after the hide animation has finished.
50 window->Hide();
51 window->layer()->GetAnimator()->StopAnimating();
52 EXPECT_FALSE(window->layer()->visible());
53 EXPECT_FALSE(window->IsVisible());
54 }
55
56 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/visibility_controller.cc ('k') | ui/wm/core/window_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698