OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ui/base/cocoa/controls/hyperlink_button_cell.h" |
| 6 |
5 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
6 | 8 |
7 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
10 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.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 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 14 |
| 15 namespace ui { |
| 16 |
| 17 namespace { |
13 | 18 |
14 class HyperlinkButtonCellTest : public CocoaTest { | 19 class HyperlinkButtonCellTest : public CocoaTest { |
15 public: | 20 public: |
16 HyperlinkButtonCellTest() { | 21 HyperlinkButtonCellTest() { |
17 NSRect frame = NSMakeRect(0, 0, 50, 30); | 22 NSRect frame = NSMakeRect(0, 0, 50, 30); |
18 base::scoped_nsobject<NSButton> view( | 23 base::scoped_nsobject<NSButton> view( |
19 [[NSButton alloc] initWithFrame:frame]); | 24 [[NSButton alloc] initWithFrame:frame]); |
20 view_ = view.get(); | 25 view_ = view.get(); |
21 base::scoped_nsobject<HyperlinkButtonCell> cell( | 26 base::scoped_nsobject<HyperlinkButtonCell> cell( |
22 [[HyperlinkButtonCell alloc] initTextCell:@"Testing"]); | 27 [[HyperlinkButtonCell alloc] initTextCell:@"Testing"]); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 [cell_ mouseExited:nil]; | 107 [cell_ mouseExited:nil]; |
103 EXPECT_TRUE(HasUnderlineAttribute([cell_ linkAttributes])); | 108 EXPECT_TRUE(HasUnderlineAttribute([cell_ linkAttributes])); |
104 | 109 |
105 [cell_ setUnderlineOnHover:YES]; | 110 [cell_ setUnderlineOnHover:YES]; |
106 EXPECT_FALSE(HasUnderlineAttribute([cell_ linkAttributes])); | 111 EXPECT_FALSE(HasUnderlineAttribute([cell_ linkAttributes])); |
107 [cell_ mouseEntered:nil]; | 112 [cell_ mouseEntered:nil]; |
108 EXPECT_TRUE(HasUnderlineAttribute([cell_ linkAttributes])); | 113 EXPECT_TRUE(HasUnderlineAttribute([cell_ linkAttributes])); |
109 [cell_ mouseExited:nil]; | 114 [cell_ mouseExited:nil]; |
110 EXPECT_FALSE(HasUnderlineAttribute([cell_ linkAttributes])); | 115 EXPECT_FALSE(HasUnderlineAttribute([cell_ linkAttributes])); |
111 } | 116 } |
| 117 |
| 118 } // namespace |
| 119 |
| 120 } // namespace ui |
OLD | NEW |