Chromium Code Reviews| Index: chrome/browser/ui/cocoa/circular_activity_indicator_view_unittest.mm |
| diff --git a/chrome/browser/ui/cocoa/circular_activity_indicator_view_unittest.mm b/chrome/browser/ui/cocoa/circular_activity_indicator_view_unittest.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ec96b8e898c2f074f60b64b4fbbcdd47f7106c51 |
| --- /dev/null |
| +++ b/chrome/browser/ui/cocoa/circular_activity_indicator_view_unittest.mm |
| @@ -0,0 +1,71 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/cocoa/circular_activity_indicator_view.h" |
| + |
| +#import "ui/gfx/test/ui_cocoa_test_helper.h" |
| + |
| +@interface TestCircularActivityIndicatorView : CircularActivityIndicatorView |
|
groby-ooo-7-16
2015/03/31 23:07:01
nit: common pattern is to just make it an (Exposed
shrike
2015/04/01 15:30:46
Done.
|
| + |
| +- (BOOL)is_animating; |
| + |
| +@end |
| + |
| +@implementation TestCircularActivityIndicatorView |
| + |
| +- (BOOL)is_animating |
| +{ |
| + return is_animating_; |
| +} |
| + |
| +@end |
| + |
| +namespace { |
| + |
| + class CircularActivityIndicatorViewTest : public ui::CocoaTest { |
| + public: |
| + CircularActivityIndicatorViewTest() { |
| + CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0); |
| + view_.reset([[TestCircularActivityIndicatorView alloc] |
| + initWithFrame:frame]); |
| + [[test_window() contentView] addSubview:view_]; |
| + } |
| + |
| + base::scoped_nsobject<TestCircularActivityIndicatorView> view_; |
| + }; |
| + |
| + TEST_VIEW(CircularActivityIndicatorViewTest, view_) |
| + |
| + TEST_F(CircularActivityIndicatorViewTest, StopAnimationOnMiniaturize) { |
| + EXPECT_TRUE([view_ is_animating]); |
| + |
| + [test_window() miniaturize:nil]; |
| + EXPECT_FALSE([view_ is_animating]); |
| + |
| + [test_window() deminiaturize:nil]; |
| + EXPECT_TRUE([view_ is_animating]); |
| + } |
| + |
| + TEST_F(CircularActivityIndicatorViewTest, |
| + StopAnimationOnRemoveFromSuperview) { |
| + EXPECT_TRUE([view_ is_animating]); |
| + |
| + [view_ removeFromSuperview]; |
| + EXPECT_FALSE([view_ is_animating]); |
| + |
| + [[test_window() contentView] addSubview:view_]; |
| + EXPECT_TRUE([view_ is_animating]); |
| + } |
| + |
| + TEST_F(CircularActivityIndicatorViewTest, StopAnimationOnHidden) { |
| + EXPECT_TRUE([view_ is_animating]); |
| + |
| + [view_ setHidden:YES]; |
| + EXPECT_FALSE([view_ is_animating]); |
| + |
| + [view_ setHidden:NO]; |
| + EXPECT_TRUE([view_ is_animating]); |
| + } |
| +} |
| + |