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 "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
11 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 11 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 #include "ui/gfx/text_elider.h" | 14 #include "ui/gfx/text_elider.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 const float kLargeWidth = 10000; | |
19 | |
20 // Returns the length of the run starting at |location| for which | 18 // Returns the length of the run starting at |location| for which |
21 // |attributeName| remains the same. | 19 // |attributeName| remains the same. |
22 NSUInteger RunLengthForAttribute(NSAttributedString* string, | 20 NSUInteger RunLengthForAttribute(NSAttributedString* string, |
23 NSUInteger location, | 21 NSUInteger location, |
24 NSString* attributeName) { | 22 NSString* attributeName) { |
25 const NSRange full_range = NSMakeRange(0, [string length]); | 23 const NSRange full_range = NSMakeRange(0, [string length]); |
26 NSRange range; | 24 NSRange range; |
27 [string attribute:attributeName | 25 [string attribute:attributeName |
28 atIndex:location longestEffectiveRange:&range inRange:full_range]; | 26 atIndex:location longestEffectiveRange:&range inRange:full_range]; |
29 | 27 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 EXPECT_GT(popup_view.GetTargetBounds().height(), old_height); | 350 EXPECT_GT(popup_view.GetTargetBounds().height(), old_height); |
353 EXPECT_EQ(5, [popup_view.matrix() numberOfRows]); | 351 EXPECT_EQ(5, [popup_view.matrix() numberOfRows]); |
354 | 352 |
355 popup_view.SetResultCount(0); | 353 popup_view.SetResultCount(0); |
356 popup_view.UpdatePopupAppearance(); | 354 popup_view.UpdatePopupAppearance(); |
357 EXPECT_FALSE(popup_view.IsOpen()); | 355 EXPECT_FALSE(popup_view.IsOpen()); |
358 EXPECT_EQ(0, [popup_view.matrix() numberOfRows]); | 356 EXPECT_EQ(0, [popup_view.matrix() numberOfRows]); |
359 } | 357 } |
360 | 358 |
361 } // namespace | 359 } // namespace |
OLD | NEW |