| 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 #include "base/memory/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #include "base/message_loop/message_pump_mac.h" | 6 #include "base/message_loop/message_pump_mac.h" |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 7 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_animation
.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_animation
.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
| 9 | 9 |
| 10 // This class runs an animation for exactly two frames then end it. | 10 // This class runs an animation for exactly two frames then end it. |
| 11 @interface ConstrainedWindowAnimationTestDelegate : NSObject | 11 @interface ConstrainedWindowAnimationTestDelegate : NSObject |
| 12 <NSAnimationDelegate> { | 12 <NSAnimationDelegate> { |
| 13 @private | 13 @private |
| 14 CGFloat frameCount_; | 14 CGFloat frameCount_; |
| 15 scoped_refptr<base::MessagePumpNSRunLoop> message_pump_; | 15 scoped_refptr<base::MessagePumpNSRunLoop> message_pump_; |
| 16 } | 16 } |
| 17 | 17 |
| 18 - (void)runAnimation:(NSAnimation*)animation; | 18 - (void)runAnimation:(NSAnimation*)animation; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 @end | 52 @end |
| 53 | 53 |
| 54 class ConstrainedWindowAnimationTest : public CocoaTest { | 54 class ConstrainedWindowAnimationTest : public CocoaTest { |
| 55 protected: | 55 protected: |
| 56 ConstrainedWindowAnimationTest() : CocoaTest() { | 56 ConstrainedWindowAnimationTest() : CocoaTest() { |
| 57 delegate_.reset([[ConstrainedWindowAnimationTestDelegate alloc] init]); | 57 delegate_.reset([[ConstrainedWindowAnimationTestDelegate alloc] init]); |
| 58 } | 58 } |
| 59 | 59 |
| 60 scoped_nsobject<ConstrainedWindowAnimationTestDelegate> delegate_; | 60 base::scoped_nsobject<ConstrainedWindowAnimationTestDelegate> delegate_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Test the show animation. | 63 // Test the show animation. |
| 64 TEST_F(ConstrainedWindowAnimationTest, Show) { | 64 TEST_F(ConstrainedWindowAnimationTest, Show) { |
| 65 scoped_nsobject<NSAnimation> animation( | 65 base::scoped_nsobject<NSAnimation> animation( |
| 66 [[ConstrainedWindowAnimationShow alloc] initWithWindow:test_window()]); | 66 [[ConstrainedWindowAnimationShow alloc] initWithWindow:test_window()]); |
| 67 [delegate_ runAnimation:animation]; | 67 [delegate_ runAnimation:animation]; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Test the hide animation. | 70 // Test the hide animation. |
| 71 TEST_F(ConstrainedWindowAnimationTest, Hide) { | 71 TEST_F(ConstrainedWindowAnimationTest, Hide) { |
| 72 scoped_nsobject<NSAnimation> animation( | 72 base::scoped_nsobject<NSAnimation> animation( |
| 73 [[ConstrainedWindowAnimationHide alloc] initWithWindow:test_window()]); | 73 [[ConstrainedWindowAnimationHide alloc] initWithWindow:test_window()]); |
| 74 [delegate_ runAnimation:animation]; | 74 [delegate_ runAnimation:animation]; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Test the pulse animation. | 77 // Test the pulse animation. |
| 78 TEST_F(ConstrainedWindowAnimationTest, Pulse) { | 78 TEST_F(ConstrainedWindowAnimationTest, Pulse) { |
| 79 scoped_nsobject<NSAnimation> animation( | 79 base::scoped_nsobject<NSAnimation> animation( |
| 80 [[ConstrainedWindowAnimationPulse alloc] initWithWindow:test_window()]); | 80 [[ConstrainedWindowAnimationPulse alloc] initWithWindow:test_window()]); |
| 81 [delegate_ runAnimation:animation]; | 81 [delegate_ runAnimation:animation]; |
| 82 } | 82 } |
| OLD | NEW |