OLD | NEW |
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 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
6 #include "base/memory/scoped_ptr.h" | |
7 #include "base/message_loop/message_pump_mac.h" | 10 #include "base/message_loop/message_pump_mac.h" |
8 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" | |
9 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 11 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
10 | 12 |
11 // This class runs an animation for exactly two frames then end it. | 13 // This class runs an animation for exactly two frames then end it. |
12 @interface ConstrainedWindowAnimationTestDelegate | 14 @interface ConstrainedWindowAnimationTestDelegate |
13 : NSObject<NSAnimationDelegate> { | 15 : NSObject<NSAnimationDelegate> { |
14 @private | 16 @private |
15 CGFloat frameCount_; | 17 CGFloat frameCount_; |
16 scoped_ptr<base::MessagePumpNSRunLoop> message_pump_; | 18 std::unique_ptr<base::MessagePumpNSRunLoop> message_pump_; |
17 } | 19 } |
18 | 20 |
19 - (void)runAnimation:(NSAnimation*)animation; | 21 - (void)runAnimation:(NSAnimation*)animation; |
20 | 22 |
21 @end | 23 @end |
22 | 24 |
23 @implementation ConstrainedWindowAnimationTestDelegate | 25 @implementation ConstrainedWindowAnimationTestDelegate |
24 | 26 |
25 - (id)init { | 27 - (id)init { |
26 if ((self = [super init])) | 28 if ((self = [super init])) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 [[ConstrainedWindowAnimationHide alloc] initWithWindow:test_window()]); | 76 [[ConstrainedWindowAnimationHide alloc] initWithWindow:test_window()]); |
75 [delegate_ runAnimation:animation]; | 77 [delegate_ runAnimation:animation]; |
76 } | 78 } |
77 | 79 |
78 // Test the pulse animation. | 80 // Test the pulse animation. |
79 TEST_F(ConstrainedWindowAnimationTest, Pulse) { | 81 TEST_F(ConstrainedWindowAnimationTest, Pulse) { |
80 base::scoped_nsobject<NSAnimation> animation( | 82 base::scoped_nsobject<NSAnimation> animation( |
81 [[ConstrainedWindowAnimationPulse alloc] initWithWindow:test_window()]); | 83 [[ConstrainedWindowAnimationPulse alloc] initWithWindow:test_window()]); |
82 [delegate_ runAnimation:animation]; | 84 [delegate_ runAnimation:animation]; |
83 } | 85 } |
OLD | NEW |