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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/cocoa/spinner_view.h"
7 #import "ui/gfx/test/ui_cocoa_test_helper.h"
11 class SpinnerViewTest : public ui::CocoaTest {
14 CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0);
15 view_.reset([[SpinnerView alloc] initWithFrame:frame]);
16 [[test_window() contentView] addSubview:view_];
19 base::scoped_nsobject<SpinnerView> view_;
22 TEST_VIEW(SpinnerViewTest, view_)
24 TEST_F(SpinnerViewTest, StopAnimationOnMiniaturize) {
25 EXPECT_TRUE([view_ isAnimating]);
27 [test_window() miniaturize:nil];
28 EXPECT_FALSE([view_ isAnimating]);
30 [test_window() deminiaturize:nil];
31 EXPECT_TRUE([view_ isAnimating]);
34 TEST_F(SpinnerViewTest, StopAnimationOnRemoveFromSuperview) {
35 EXPECT_TRUE([view_ isAnimating]);
37 [view_ removeFromSuperview];
38 EXPECT_FALSE([view_ isAnimating]);
40 [[test_window() contentView] addSubview:view_];
41 EXPECT_TRUE([view_ isAnimating]);
44 TEST_F(SpinnerViewTest, StopAnimationOnHidden) {
45 EXPECT_TRUE([view_ isAnimating]);
47 [view_ setHidden:YES];
48 EXPECT_FALSE([view_ isAnimating]);
51 EXPECT_TRUE([view_ isAnimating]);