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

Side by Side Diff: ash/wm/window_animations_unittest.cc

Issue 645513008: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « ash/wm/window_animations.cc ('k') | ash/wm/window_cycle_controller.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 "ash/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include "ash/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
10 #include "ash/wm/workspace_controller.h" 10 #include "ash/wm/workspace_controller.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "ui/aura/test/test_windows.h" 12 #include "ui/aura/test/test_windows.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/compositor/layer.h" 14 #include "ui/compositor/layer.h"
15 #include "ui/compositor/layer_animation_observer.h" 15 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/compositor/layer_animator.h" 16 #include "ui/compositor/layer_animator.h"
17 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 17 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
18 #include "ui/compositor/scoped_layer_animation_settings.h" 18 #include "ui/compositor/scoped_layer_animation_settings.h"
19 19
20 using aura::Window; 20 using aura::Window;
21 using ui::Layer; 21 using ui::Layer;
22 22
23 namespace ash { 23 namespace ash {
24 class WindowAnimationsTest : public ash::test::AshTestBase { 24 class WindowAnimationsTest : public ash::test::AshTestBase {
25 public: 25 public:
26 WindowAnimationsTest() {} 26 WindowAnimationsTest() {}
27 27
28 virtual void TearDown() override { 28 void TearDown() override { AshTestBase::TearDown(); }
29 AshTestBase::TearDown();
30 }
31 29
32 private: 30 private:
33 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); 31 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest);
34 }; 32 };
35 33
36 // Listens to animation scheduled notifications. Remembers the transition 34 // Listens to animation scheduled notifications. Remembers the transition
37 // duration of the first sequence. 35 // duration of the first sequence.
38 class MinimizeAnimationObserver : public ui::LayerAnimationObserver { 36 class MinimizeAnimationObserver : public ui::LayerAnimationObserver {
39 public: 37 public:
40 explicit MinimizeAnimationObserver(ui::LayerAnimator* animator) 38 explicit MinimizeAnimationObserver(ui::LayerAnimator* animator)
41 : animator_(animator) { 39 : animator_(animator) {
42 animator_->AddObserver(this); 40 animator_->AddObserver(this);
43 // RemoveObserver is called when the first animation is scheduled and so 41 // RemoveObserver is called when the first animation is scheduled and so
44 // there should be no need for now to remove it in destructor. 42 // there should be no need for now to remove it in destructor.
45 }; 43 };
46 base::TimeDelta duration() { return duration_; } 44 base::TimeDelta duration() { return duration_; }
47 45
48 protected: 46 protected:
49 // ui::LayerAnimationObserver: 47 // ui::LayerAnimationObserver:
50 virtual void OnLayerAnimationScheduled( 48 void OnLayerAnimationScheduled(
51 ui::LayerAnimationSequence* sequence) override { 49 ui::LayerAnimationSequence* sequence) override {
52 duration_ = animator_->GetTransitionDuration(); 50 duration_ = animator_->GetTransitionDuration();
53 animator_->RemoveObserver(this); 51 animator_->RemoveObserver(this);
54 } 52 }
55 virtual void OnLayerAnimationEnded( 53 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override {}
56 ui::LayerAnimationSequence* sequence) override {} 54 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override {}
57 virtual void OnLayerAnimationAborted(
58 ui::LayerAnimationSequence* sequence) override {}
59 55
60 private: 56 private:
61 ui::LayerAnimator* animator_; 57 ui::LayerAnimator* animator_;
62 base::TimeDelta duration_; 58 base::TimeDelta duration_;
63 59
64 DISALLOW_COPY_AND_ASSIGN(MinimizeAnimationObserver); 60 DISALLOW_COPY_AND_ASSIGN(MinimizeAnimationObserver);
65 }; 61 };
66 62
67 TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { 63 TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) {
68 ui::ScopedAnimationDurationScaleMode test_duration_mode( 64 ui::ScopedAnimationDurationScaleMode test_duration_mode(
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 EXPECT_TRUE(layer->GetAnimator()->is_animating()); 276 EXPECT_TRUE(layer->GetAnimator()->is_animating());
281 // Expect default duration (200ms for stock ash minimizing animation). 277 // Expect default duration (200ms for stock ash minimizing animation).
282 EXPECT_EQ(default_duration.InMilliseconds(), 278 EXPECT_EQ(default_duration.InMilliseconds(),
283 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); 279 layer->GetAnimator()->GetTransitionDuration().InMilliseconds());
284 window->Show(); 280 window->Show();
285 layer->GetAnimator()->StopAnimating(); 281 layer->GetAnimator()->StopAnimating();
286 } 282 }
287 } 283 }
288 284
289 } // namespace ash 285 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_animations.cc ('k') | ash/wm/window_cycle_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698