| 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/tab_projecting_image_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/tab_projecting_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 TabProjectingImageViewTest : public CocoaTest { | 14 class TabProjectingImageViewTest : public CocoaTest { |
| 15 public: | 15 public: |
| 16 TabProjectingImageViewTest() { | 16 TabProjectingImageViewTest() { |
| 17 scoped_nsobject<NSImage> backgroundImage( | 17 base::scoped_nsobject<NSImage> backgroundImage( |
| 18 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); | 18 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); |
| 19 [backgroundImage lockFocus]; | 19 [backgroundImage lockFocus]; |
| 20 NSRectFill(NSMakeRect(0, 0, 16, 16)); | 20 NSRectFill(NSMakeRect(0, 0, 16, 16)); |
| 21 [backgroundImage unlockFocus]; | 21 [backgroundImage unlockFocus]; |
| 22 | 22 |
| 23 scoped_nsobject<NSImage> projectorImage( | 23 base::scoped_nsobject<NSImage> projectorImage( |
| 24 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); | 24 [[NSImage alloc] initWithSize:NSMakeSize(16, 16)]); |
| 25 [projectorImage lockFocus]; | 25 [projectorImage lockFocus]; |
| 26 NSRectFill(NSMakeRect(0, 0, 16, 16)); | 26 NSRectFill(NSMakeRect(0, 0, 16, 16)); |
| 27 [projectorImage unlockFocus]; | 27 [projectorImage unlockFocus]; |
| 28 | 28 |
| 29 scoped_nsobject<NSImage> throbImage( | 29 base::scoped_nsobject<NSImage> throbImage( |
| 30 [[NSImage alloc] initWithSize:NSMakeSize(32, 32)]); | 30 [[NSImage alloc] initWithSize:NSMakeSize(32, 32)]); |
| 31 [throbImage lockFocus]; | 31 [throbImage lockFocus]; |
| 32 NSRectFill(NSMakeRect(0, 0, 32, 32)); | 32 NSRectFill(NSMakeRect(0, 0, 32, 32)); |
| 33 [throbImage unlockFocus]; | 33 [throbImage unlockFocus]; |
| 34 | 34 |
| 35 scoped_nsobject<TabProjectingImageView> view([[TabProjectingImageView alloc] | 35 base::scoped_nsobject<TabProjectingImageView> view( |
| 36 initWithFrame:NSMakeRect(0, 0, 32, 32) | 36 [[TabProjectingImageView alloc] initWithFrame:NSMakeRect(0, 0, 32, 32) |
| 37 backgroundImage:backgroundImage | 37 backgroundImage:backgroundImage |
| 38 projectorImage:projectorImage | 38 projectorImage:projectorImage |
| 39 throbImage:throbImage | 39 throbImage:throbImage |
| 40 durationMS:20 | 40 durationMS:20 |
| 41 animationContainer:NULL]); | 41 animationContainer:NULL]); |
| 42 view_ = view.get(); | 42 view_ = view.get(); |
| 43 [[test_window() contentView] addSubview:view_]; | 43 [[test_window() contentView] addSubview:view_]; |
| 44 } | 44 } |
| 45 | 45 |
| 46 base::MessageLoopForUI message_loop_; // Needed for ui::ThrobAnimation. | 46 base::MessageLoopForUI message_loop_; // Needed for ui::ThrobAnimation. |
| 47 TabProjectingImageView* view_; | 47 TabProjectingImageView* view_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 TEST_VIEW(TabProjectingImageViewTest, view_) | 50 TEST_VIEW(TabProjectingImageViewTest, view_) |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| OLD | NEW |