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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
8 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" | 9 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" |
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
12 | 12 |
13 @interface GradientButtonCell (HoverValueTesting) | 13 @interface GradientButtonCell (HoverValueTesting) |
14 - (void)performOnePulseStep; | 14 - (void)performOnePulseStep; |
15 @end | 15 @end |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 class GradientButtonCellTest : public CocoaTest { | 19 class GradientButtonCellTest : public CocoaTest { |
20 public: | 20 public: |
21 GradientButtonCellTest() { | 21 GradientButtonCellTest() { |
22 NSRect frame = NSMakeRect(0, 0, 50, 30); | 22 NSRect frame = NSMakeRect(0, 0, 50, 30); |
23 scoped_nsobject<NSButton>view([[NSButton alloc] initWithFrame:frame]); | 23 base::scoped_nsobject<NSButton> view( |
| 24 [[NSButton alloc] initWithFrame:frame]); |
24 view_ = view.get(); | 25 view_ = view.get(); |
25 scoped_nsobject<GradientButtonCell> cell([[GradientButtonCell alloc] | 26 base::scoped_nsobject<GradientButtonCell> cell( |
26 initTextCell:@"Testing"]); | 27 [[GradientButtonCell alloc] initTextCell:@"Testing"]); |
27 [view_ setCell:cell.get()]; | 28 [view_ setCell:cell.get()]; |
28 [[test_window() contentView] addSubview:view_]; | 29 [[test_window() contentView] addSubview:view_]; |
29 } | 30 } |
30 | 31 |
31 NSButton* view_; | 32 NSButton* view_; |
32 }; | 33 }; |
33 | 34 |
34 TEST_VIEW(GradientButtonCellTest, view_) | 35 TEST_VIEW(GradientButtonCellTest, view_) |
35 | 36 |
36 // Test drawing, mostly to ensure nothing leaks or crashes. | 37 // Test drawing, mostly to ensure nothing leaks or crashes. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 111 } |
111 | 112 |
112 // Test drawing when first responder, mostly to ensure nothing leaks or | 113 // Test drawing when first responder, mostly to ensure nothing leaks or |
113 // crashes. | 114 // crashes. |
114 TEST_F(GradientButtonCellTest, FirstResponder) { | 115 TEST_F(GradientButtonCellTest, FirstResponder) { |
115 [test_window() makePretendKeyWindowAndSetFirstResponder:view_]; | 116 [test_window() makePretendKeyWindowAndSetFirstResponder:view_]; |
116 [view_ display]; | 117 [view_ display]; |
117 } | 118 } |
118 | 119 |
119 } // namespace | 120 } // namespace |
OLD | NEW |