| Index: chrome/browser/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
|
| diff --git a/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm b/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
|
| index 6ae696d7f55cec66fdf1a06df07308a82ef31da6..f22de95cc8f7b75b8cee077d1b5ff968dba7d52e 100644
|
| --- a/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
|
| +++ b/chrome/browser/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
|
| @@ -12,6 +12,7 @@
|
| #import "chrome/browser/cocoa/location_bar/location_bar_decoration.h"
|
| #import "chrome/browser/cocoa/location_bar/location_icon_decoration.h"
|
| #import "chrome/browser/cocoa/location_bar/selected_keyword_decoration.h"
|
| +#import "chrome/browser/cocoa/location_bar/star_decoration.h"
|
| #include "grit/theme_resources.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -117,11 +118,17 @@ TEST_F(AutocompleteTextFieldCellTest, FocusedDisplay) {
|
| availableWidth:kWidth];
|
| [view_ display];
|
|
|
| - // Load available decorations and try drawing.
|
| + // Load available decorations and try drawing. To make sure that
|
| + // they are actually drawn, check that |GetWidthForSpace()| doesn't
|
| + // indicate that they should be omitted.
|
| + const CGFloat kVeryWide = 1000.0;
|
| +
|
| SelectedKeywordDecoration selected_keyword_decoration([view_ font]);
|
| selected_keyword_decoration.SetVisible(true);
|
| selected_keyword_decoration.SetKeyword(std::wstring(L"Google"), false);
|
| [cell addLeftDecoration:&selected_keyword_decoration];
|
| + EXPECT_NE(selected_keyword_decoration.GetWidthForSpace(kVeryWide),
|
| + LocationBarDecoration::kOmittedWidth);
|
|
|
| // TODO(shess): This really wants a |LocationBarViewMac|, but only a
|
| // few methods reference it, so this works well enough. But
|
| @@ -130,6 +137,8 @@ TEST_F(AutocompleteTextFieldCellTest, FocusedDisplay) {
|
| location_icon_decoration.SetVisible(true);
|
| location_icon_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]);
|
| [cell addLeftDecoration:&location_icon_decoration];
|
| + EXPECT_NE(location_icon_decoration.GetWidthForSpace(kVeryWide),
|
| + LocationBarDecoration::kOmittedWidth);
|
|
|
| EVBubbleDecoration ev_bubble_decoration(&location_icon_decoration,
|
| [view_ font]);
|
| @@ -137,12 +146,22 @@ TEST_F(AutocompleteTextFieldCellTest, FocusedDisplay) {
|
| ev_bubble_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]);
|
| ev_bubble_decoration.SetLabel(@"Application");
|
| [cell addLeftDecoration:&ev_bubble_decoration];
|
| + EXPECT_NE(ev_bubble_decoration.GetWidthForSpace(kVeryWide),
|
| + LocationBarDecoration::kOmittedWidth);
|
| +
|
| + StarDecoration star_decoration(NULL);
|
| + star_decoration.SetVisible(true);
|
| + [cell addRightDecoration:&star_decoration];
|
| + EXPECT_NE(star_decoration.GetWidthForSpace(kVeryWide),
|
| + LocationBarDecoration::kOmittedWidth);
|
|
|
| // Make sure we're actually calling |DrawInFrame()|.
|
| StrictMock<MockDecoration> mock_decoration;
|
| mock_decoration.SetVisible(true);
|
| [cell addLeftDecoration:&mock_decoration];
|
| EXPECT_CALL(mock_decoration, DrawInFrame(_, _));
|
| + EXPECT_NE(mock_decoration.GetWidthForSpace(kVeryWide),
|
| + LocationBarDecoration::kOmittedWidth);
|
|
|
| [view_ display];
|
|
|
|
|