| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/cocoa/spinner_view.h" | 5 #include "chrome/browser/ui/cocoa/spinner_view.h" |
| 6 | 6 |
| 7 #include "base/mac/mac_util.h" |
| 7 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 8 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
| 8 | 9 |
| 9 namespace { | 10 namespace { |
| 10 | 11 |
| 11 class SpinnerViewTest : public ui::CocoaTest { | 12 class SpinnerViewTest : public ui::CocoaTest { |
| 12 public: | 13 public: |
| 13 SpinnerViewTest() { | 14 SpinnerViewTest() { |
| 14 CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0); | 15 CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0); |
| 15 view_.reset([[SpinnerView alloc] initWithFrame:frame]); | 16 view_.reset([[SpinnerView alloc] initWithFrame:frame]); |
| 16 [[test_window() contentView] addSubview:view_]; | 17 [[test_window() contentView] addSubview:view_]; |
| 17 } | 18 } |
| 18 | 19 |
| 19 base::scoped_nsobject<SpinnerView> view_; | 20 base::scoped_nsobject<SpinnerView> view_; |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 TEST_VIEW(SpinnerViewTest, view_) | 23 TEST_VIEW(SpinnerViewTest, view_) |
| 23 | 24 |
| 24 TEST_F(SpinnerViewTest, StopAnimationOnMiniaturize) { | 25 TEST_F(SpinnerViewTest, StopAnimationOnMiniaturize) { |
| 26 if (base::mac::IsOS10_10()) |
| 27 return; // Fails when swarmed. http://crbug.com/660582 |
| 25 EXPECT_TRUE([view_ isAnimating]); | 28 EXPECT_TRUE([view_ isAnimating]); |
| 26 | 29 |
| 27 [test_window() miniaturize:nil]; | 30 [test_window() miniaturize:nil]; |
| 28 EXPECT_FALSE([view_ isAnimating]); | 31 EXPECT_FALSE([view_ isAnimating]); |
| 29 | 32 |
| 30 [test_window() deminiaturize:nil]; | 33 [test_window() deminiaturize:nil]; |
| 31 EXPECT_TRUE([view_ isAnimating]); | 34 EXPECT_TRUE([view_ isAnimating]); |
| 32 } | 35 } |
| 33 | 36 |
| 34 TEST_F(SpinnerViewTest, StopAnimationOnRemoveFromSuperview) { | 37 TEST_F(SpinnerViewTest, StopAnimationOnRemoveFromSuperview) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 EXPECT_TRUE([view_ isAnimating]); | 48 EXPECT_TRUE([view_ isAnimating]); |
| 46 | 49 |
| 47 [view_ setHidden:YES]; | 50 [view_ setHidden:YES]; |
| 48 EXPECT_FALSE([view_ isAnimating]); | 51 EXPECT_FALSE([view_ isAnimating]); |
| 49 | 52 |
| 50 [view_ setHidden:NO]; | 53 [view_ setHidden:NO]; |
| 51 EXPECT_TRUE([view_ isAnimating]); | 54 EXPECT_TRUE([view_ isAnimating]); |
| 52 } | 55 } |
| 53 | 56 |
| 54 } // namespace | 57 } // namespace |
| OLD | NEW |