| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 class ThrobbingImageViewTest : public CocoaTest { | 14 class ThrobbingImageViewTest : public CocoaTest { |
| 15 public: | 15 public: |
| 16 ThrobbingImageViewTest() { | 16 ThrobbingImageViewTest() { |
| 17 scoped_nsobject<NSImage> image( | 17 scoped_nsobject<NSImage> image( |
| 18 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); | 18 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); |
| 19 [image lockFocus]; | 19 [image lockFocus]; |
| 20 NSRectFill(NSMakeRect(0, 0, 16, 16)); | 20 NSRectFill(NSMakeRect(0, 0, 16, 16)); |
| 21 [image unlockFocus]; | 21 [image unlockFocus]; |
| 22 | 22 |
| 23 scoped_nsobject<ThrobbingImageView> view([[ThrobbingImageView alloc] | 23 scoped_nsobject<ThrobbingImageView> view([[ThrobbingImageView alloc] |
| 24 initWithFrame:NSMakeRect(0, 0, 16, 16) | 24 initWithFrame:NSMakeRect(0, 0, 16, 16) |
| 25 backgroundImage:image | 25 backgroundImage:image |
| 26 throbImage:image | 26 throbImage:image |
| 27 durationMS:20 | 27 durationMS:20 |
| 28 throbPosition:kThrobPositionOverlay]); | 28 throbPosition:kThrobPositionOverlay |
| 29 animationContainer:NULL]); |
| 29 view_ = view.get(); | 30 view_ = view.get(); |
| 30 [[test_window() contentView] addSubview:view_]; | 31 [[test_window() contentView] addSubview:view_]; |
| 31 } | 32 } |
| 32 | 33 |
| 33 MessageLoopForUI message_loop_; // Needed for ui::ThrobAnimation. | 34 MessageLoopForUI message_loop_; // Needed for ui::ThrobAnimation. |
| 34 ThrobbingImageView* view_; | 35 ThrobbingImageView* view_; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 TEST_VIEW(ThrobbingImageViewTest, view_) | 38 TEST_VIEW(ThrobbingImageViewTest, view_) |
| 38 | 39 |
| 39 } // namespace | 40 } // namespace |
| 40 | 41 |
| OLD | NEW |