| 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 #include "base/mac/scoped_nsobject.h" | 5 #include "base/mac/scoped_nsobject.h" |
| 6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 6 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 7 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" | 7 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
| 8 #include "testing/gtest_mac.h" | 8 #include "testing/gtest_mac.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 [linkAttributes setObject:@"Name:Four" forKey:NSLinkAttributeName]; | 180 [linkAttributes setObject:@"Name:Four" forKey:NSLinkAttributeName]; |
| 181 attributes = [[view_ textStorage] attributesAtIndex:14 | 181 attributes = [[view_ textStorage] attributesAtIndex:14 |
| 182 longestEffectiveRange:&range | 182 longestEffectiveRange:&range |
| 183 inRange:rangeLimit]; | 183 inRange:rangeLimit]; |
| 184 EXPECT_EQ(14U, range.location); | 184 EXPECT_EQ(14U, range.location); |
| 185 EXPECT_EQ(4U, range.length); | 185 EXPECT_EQ(4U, range.length); |
| 186 EXPECT_NSEQ(linkAttributes, attributes); | 186 EXPECT_NSEQ(linkAttributes, attributes); |
| 187 } | 187 } |
| 188 | 188 |
| 189 TEST_F(HyperlinkTextViewTest, FirstResponderBehavior) { |
| 190 // By default, accept. |
| 191 EXPECT_TRUE([view_ acceptsFirstResponder]); |
| 192 |
| 193 [view_ setRefusesFirstResponder:YES]; |
| 194 EXPECT_FALSE([view_ acceptsFirstResponder]); |
| 195 } |
| 196 |
| 189 } // namespace | 197 } // namespace |
| OLD | NEW |