OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 #import "base/memory/scoped_nsobject.h" |
| 6 #include "base/message_loop.h" |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 8 #import "chrome/browser/ui/cocoa/spinner_progress_indicator.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/platform_test.h" |
| 11 |
| 12 class SpinnerProgressIndicatorTest : public CocoaTest { |
| 13 public: |
| 14 SpinnerProgressIndicatorTest() { |
| 15 view_.reset([[SpinnerProgressIndicator alloc] initWithFrame:NSZeroRect]); |
| 16 [view_ sizeToFit]; |
| 17 [[test_window() contentView] addSubview:view_]; |
| 18 } |
| 19 |
| 20 protected: |
| 21 scoped_nsobject<SpinnerProgressIndicator> view_; |
| 22 // Need for the progress indicator timer. |
| 23 MessageLoop message_loop_; |
| 24 }; |
| 25 |
| 26 TEST_VIEW(SpinnerProgressIndicatorTest, view_) |
| 27 |
| 28 // Test determinate. |
| 29 TEST_F(SpinnerProgressIndicatorTest, Determinate) { |
| 30 [view_ setIsIndeterminate:NO]; |
| 31 [view_ setPercentDone:0]; |
| 32 [view_ display]; |
| 33 [view_ setPercentDone:50]; |
| 34 [view_ display]; |
| 35 } |
| 36 |
| 37 // Test indeterminate. |
| 38 TEST_F(SpinnerProgressIndicatorTest, Indeterminate) { |
| 39 [view_ setIsIndeterminate:YES]; |
| 40 [view_ display]; |
| 41 } |
OLD | NEW |