OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autocomplete/autocomplete_popup_view_mac.h" | 5 #import "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" |
6 | 6 |
7 #include "app/text_elider.h" | 7 #include "app/text_elider.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/autocomplete/autocomplete.h" | 11 #include "chrome/browser/autocomplete/autocomplete.h" |
12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 const float kLargeWidth = 10000; | 16 const float kLargeWidth = 10000; |
17 | 17 |
18 class AutocompletePopupViewMacTest : public PlatformTest { | 18 class AutocompletePopupViewMacTest : public PlatformTest { |
19 public: | 19 public: |
20 AutocompletePopupViewMacTest() {} | 20 AutocompletePopupViewMacTest() {} |
21 | 21 |
22 virtual void SetUp() { | 22 virtual void SetUp() { |
23 PlatformTest::SetUp(); | 23 PlatformTest::SetUp(); |
24 | 24 |
25 // These are here because there is no autorelease pool for the | 25 // These are here because there is no autorelease pool for the |
26 // constructor. | 26 // constructor. |
27 color_ = [NSColor blackColor]; | 27 color_ = [NSColor blackColor]; |
28 dimColor_ = [NSColor darkGrayColor]; | 28 dimColor_ = [NSColor darkGrayColor]; |
29 font_ = gfx::Font( | 29 font_ = gfx::Font( |
30 base::SysNSStringToUTF16([[NSFont userFontOfSize:12] fontName]), 12); | 30 base::SysNSStringToWide([[NSFont userFontOfSize:12] fontName]), 12); |
31 } | 31 } |
32 | 32 |
33 // Returns the length of the run starting at |location| for which | 33 // Returns the length of the run starting at |location| for which |
34 // |attributeName| remains the same. | 34 // |attributeName| remains the same. |
35 static NSUInteger RunLengthForAttribute(NSAttributedString* string, | 35 static NSUInteger RunLengthForAttribute(NSAttributedString* string, |
36 NSUInteger location, | 36 NSUInteger location, |
37 NSString* attributeName) { | 37 NSString* attributeName) { |
38 const NSRange fullRange = NSMakeRange(0, [string length]); | 38 const NSRange fullRange = NSMakeRange(0, [string length]); |
39 NSRange range; | 39 NSRange range; |
40 [string attribute:attributeName | 40 [string attribute:attributeName |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 // updates the model's selection from the matrix before returning. | 545 // updates the model's selection from the matrix before returning. |
546 // Could possibly test that via -select:. | 546 // Could possibly test that via -select:. |
547 | 547 |
548 // TODO(shess): Test that AutocompleteButtonCell returns the right | 548 // TODO(shess): Test that AutocompleteButtonCell returns the right |
549 // background colors for on, highlighted, and neither. | 549 // background colors for on, highlighted, and neither. |
550 | 550 |
551 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized | 551 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized |
552 // and then sends -select: to the view. | 552 // and then sends -select: to the view. |
553 | 553 |
554 } // namespace | 554 } // namespace |
OLD | NEW |