Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / spinner_view_unittest.mm
blob93d652c71e4e6a829222aa482757fab0db55efae
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"
9 @interface SpinnerView (ExposedForTesting)
11 - (BOOL)isAnimating;
13 @end
15 @implementation SpinnerView (ExposedForTesting)
17 - (BOOL)isAnimating {
18   return isAnimating_;
21 @end
23 namespace {
25 class SpinnerViewTest : public ui::CocoaTest {
26  public:
27   SpinnerViewTest() {
28     CGRect frame = NSMakeRect(0.0, 0.0, 16.0, 16.0);
29     view_.reset([[SpinnerView alloc] initWithFrame:frame]);
30     [[test_window() contentView] addSubview:view_];
31   }
33   base::scoped_nsobject<SpinnerView> view_;
36 TEST_VIEW(SpinnerViewTest, view_)
38 TEST_F(SpinnerViewTest, StopAnimationOnMiniaturize) {
39   EXPECT_TRUE([view_ isAnimating]);
41   [test_window() miniaturize:nil];
42   EXPECT_FALSE([view_ isAnimating]);
44   [test_window() deminiaturize:nil];
45   EXPECT_TRUE([view_ isAnimating]);
48 TEST_F(SpinnerViewTest,
49        StopAnimationOnRemoveFromSuperview) {
50   EXPECT_TRUE([view_ isAnimating]);
52   [view_ removeFromSuperview];
53   EXPECT_FALSE([view_ isAnimating]);
55   [[test_window() contentView] addSubview:view_];
56   EXPECT_TRUE([view_ isAnimating]);
59 TEST_F(SpinnerViewTest, StopAnimationOnHidden) {
60   EXPECT_TRUE([view_ isAnimating]);
62   [view_ setHidden:YES];
63   EXPECT_FALSE([view_ isAnimating]);
65   [view_ setHidden:NO];
66   EXPECT_TRUE([view_ isAnimating]);
69 } // namespace