OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/cocoa/circular_activity_indicator_view.h" | |
6 | |
7 #import "ui/gfx/test/ui_cocoa_test_helper.h" | |
8 | |
9 @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.
| |
10 | |
11 - (BOOL)is_animating; | |
12 | |
13 @end | |
14 | |
15 @implementation TestCircularActivityIndicatorView | |
16 | |
17 - (BOOL)is_animating | |
18 { | |
19 return is_animating_; | |
20 } | |
21 | |
22 @end | |
23 | |
24 namespace { | |
25 | |
26 class CircularActivityIndicatorViewTest : public ui::CocoaTest { | |
27 public: | |
28 CircularActivityIndicatorViewTest() { | |
29 CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0); | |
30 view_.reset([[TestCircularActivityIndicatorView alloc] | |
31 initWithFrame:frame]); | |
32 [[test_window() contentView] addSubview:view_]; | |
33 } | |
34 | |
35 base::scoped_nsobject<TestCircularActivityIndicatorView> view_; | |
36 }; | |
37 | |
38 TEST_VIEW(CircularActivityIndicatorViewTest, view_) | |
39 | |
40 TEST_F(CircularActivityIndicatorViewTest, StopAnimationOnMiniaturize) { | |
41 EXPECT_TRUE([view_ is_animating]); | |
42 | |
43 [test_window() miniaturize:nil]; | |
44 EXPECT_FALSE([view_ is_animating]); | |
45 | |
46 [test_window() deminiaturize:nil]; | |
47 EXPECT_TRUE([view_ is_animating]); | |
48 } | |
49 | |
50 TEST_F(CircularActivityIndicatorViewTest, | |
51 StopAnimationOnRemoveFromSuperview) { | |
52 EXPECT_TRUE([view_ is_animating]); | |
53 | |
54 [view_ removeFromSuperview]; | |
55 EXPECT_FALSE([view_ is_animating]); | |
56 | |
57 [[test_window() contentView] addSubview:view_]; | |
58 EXPECT_TRUE([view_ is_animating]); | |
59 } | |
60 | |
61 TEST_F(CircularActivityIndicatorViewTest, StopAnimationOnHidden) { | |
62 EXPECT_TRUE([view_ is_animating]); | |
63 | |
64 [view_ setHidden:YES]; | |
65 EXPECT_FALSE([view_ is_animating]); | |
66 | |
67 [view_ setHidden:NO]; | |
68 EXPECT_TRUE([view_ is_animating]); | |
69 } | |
70 } | |
71 | |
OLD | NEW |