| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 AutocompleteTextFieldCell* cell = | 95 AutocompleteTextFieldCell* cell = |
| 96 static_cast<AutocompleteTextFieldCell*>([view_ cell]); | 96 static_cast<AutocompleteTextFieldCell*>([view_ cell]); |
| 97 | 97 |
| 98 // Load available decorations and try drawing. To make sure that | 98 // Load available decorations and try drawing. To make sure that |
| 99 // they are actually drawn, check that |GetWidthForSpace()| doesn't | 99 // they are actually drawn, check that |GetWidthForSpace()| doesn't |
| 100 // indicate that they should be omitted. | 100 // indicate that they should be omitted. |
| 101 const CGFloat kVeryWide = 1000.0; | 101 const CGFloat kVeryWide = 1000.0; |
| 102 | 102 |
| 103 SelectedKeywordDecoration selected_keyword_decoration([view_ font]); | 103 SelectedKeywordDecoration selected_keyword_decoration([view_ font]); |
| 104 selected_keyword_decoration.SetVisible(true); | 104 selected_keyword_decoration.SetVisible(true); |
| 105 selected_keyword_decoration.SetKeyword(ASCIIToUTF16("Google"), false); | 105 selected_keyword_decoration.SetKeyword(std::wstring(L"Google"), false); |
| 106 [cell addLeftDecoration:&selected_keyword_decoration]; | 106 [cell addLeftDecoration:&selected_keyword_decoration]; |
| 107 EXPECT_NE(selected_keyword_decoration.GetWidthForSpace(kVeryWide), | 107 EXPECT_NE(selected_keyword_decoration.GetWidthForSpace(kVeryWide), |
| 108 LocationBarDecoration::kOmittedWidth); | 108 LocationBarDecoration::kOmittedWidth); |
| 109 | 109 |
| 110 // TODO(shess): This really wants a |LocationBarViewMac|, but only a | 110 // TODO(shess): This really wants a |LocationBarViewMac|, but only a |
| 111 // few methods reference it, so this works well enough. But | 111 // few methods reference it, so this works well enough. But |
| 112 // something better would be nice. | 112 // something better would be nice. |
| 113 LocationIconDecoration location_icon_decoration(NULL); | 113 LocationIconDecoration location_icon_decoration(NULL); |
| 114 location_icon_decoration.SetVisible(true); | 114 location_icon_decoration.SetVisible(true); |
| 115 location_icon_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); | 115 location_icon_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // |controlView| gets the tooltip for the left decoration. | 292 // |controlView| gets the tooltip for the left decoration. |
| 293 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; | 293 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; |
| 294 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; | 294 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; |
| 295 | 295 |
| 296 [cell updateToolTipsInRect:bounds ofView:controlView]; | 296 [cell updateToolTipsInRect:bounds ofView:controlView]; |
| 297 | 297 |
| 298 [controlView verify]; | 298 [controlView verify]; |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace | 301 } // namespace |
| OLD | NEW |