| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 10 #import "chrome/browser/cocoa/hover_image_button.h" | 10 #import "chrome/browser/cocoa/hover_image_button.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
| 13 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class HoverImageButtonTest : public CocoaTest { | 17 class HoverImageButtonTest : public CocoaTest { |
| 18 public: | 18 public: |
| 19 HoverImageButtonTest() { | 19 HoverImageButtonTest() { |
| 20 NSRect content_frame = [[test_window() contentView] frame]; | 20 NSRect content_frame = [[test_window() contentView] frame]; |
| 21 scoped_nsobject<HoverImageButton> button( | 21 scoped_nsobject<HoverImageButton> button( |
| 22 [[HoverImageButton alloc] initWithFrame:content_frame]); | 22 [[HoverImageButton alloc] initWithFrame:content_frame]); |
| 23 NSRect frame = NSMakeRect(0, 0, 30, 30); | |
| 24 button_ = button.get(); | 23 button_ = button.get(); |
| 25 [[test_window() contentView] addSubview:button_]; | 24 [[test_window() contentView] addSubview:button_]; |
| 26 } | 25 } |
| 27 | 26 |
| 28 virtual void SetUp() { | 27 virtual void SetUp() { |
| 29 CocoaTest::BootstrapCocoa(); | 28 CocoaTest::BootstrapCocoa(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 HoverImageButton* button_; | 31 HoverImageButton* button_; |
| 33 }; | 32 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 59 | 58 |
| 60 [button_ mouseEntered:nil]; | 59 [button_ mouseEntered:nil]; |
| 61 [button_ drawRect:[button_ frame]]; | 60 [button_ drawRect:[button_ frame]]; |
| 62 EXPECT_EQ([button_ alphaValue], 1.0); | 61 EXPECT_EQ([button_ alphaValue], 1.0); |
| 63 [button_ mouseExited:nil]; | 62 [button_ mouseExited:nil]; |
| 64 [button_ drawRect:[button_ frame]]; | 63 [button_ drawRect:[button_ frame]]; |
| 65 EXPECT_EQ([button_ alphaValue], 0.5); | 64 EXPECT_EQ([button_ alphaValue], 0.5); |
| 66 } | 65 } |
| 67 | 66 |
| 68 } // namespace | 67 } // namespace |
| OLD | NEW |