| Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
|
| diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
|
| index 0d304d8e6d700b08d9ab8254cdc68b476fb16ee3..30bee13373ed7d2a6675370137c8670d1ea87dc2 100644
|
| --- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm
|
| @@ -574,6 +574,8 @@ TEST_F(AutocompleteTextFieldTest, LeftDecorationMouseDown) {
|
| .WillRepeatedly(Return(true));
|
|
|
| AutocompleteTextFieldCell* cell = [field_ cell];
|
| + [cell updateMouseTrackingAndToolTipsInRect:[field_ frame] ofView:field_];
|
| +
|
| const NSRect iconFrame =
|
| [cell frameForDecoration:&mock_left_decoration_ inFrame:[field_ bounds]];
|
| const NSPoint location = NSMakePoint(NSMidX(iconFrame), NSMidY(iconFrame));
|
| @@ -621,6 +623,8 @@ TEST_F(AutocompleteTextFieldTest, RightDecorationMouseDown) {
|
| .WillRepeatedly(Return(true));
|
|
|
| AutocompleteTextFieldCell* cell = [field_ cell];
|
| + [cell updateMouseTrackingAndToolTipsInRect:[field_ frame] ofView:field_];
|
| +
|
| const NSRect bounds = [field_ bounds];
|
| const NSRect iconFrame =
|
| [cell frameForDecoration:&mock_right_decoration_ inFrame:bounds];
|
| @@ -797,6 +801,34 @@ TEST_F(AutocompleteTextFieldTest, HideFocusState) {
|
| EXPECT_TRUE([FieldEditor() shouldDrawInsertionPoint]);
|
| }
|
|
|
| +// Verify that the tracking areas are added properly.
|
| +TEST_F(AutocompleteTextFieldTest, UpdateTrackingAreas) {
|
| + AutocompleteTextFieldCell* cell = [field_ cell];
|
| +
|
| + mock_left_decoration_.SetVisible(true);
|
| + mock_right_decoration_.SetVisible(true);
|
| +
|
| + EXPECT_CALL(mock_left_decoration_, AcceptsMousePress())
|
| + .WillOnce(Return(true))
|
| + .WillRepeatedly(Return(true));
|
| + EXPECT_CALL(mock_right_decoration_, AcceptsMousePress())
|
| + .WillOnce(Return(false))
|
| + .WillRepeatedly(Return(false));
|
| + [cell updateMouseTrackingAndToolTipsInRect:[field_ bounds] ofView:field_];
|
| +
|
| + EXPECT_EQ([cell mouseTrackingDecorations].size(), 1.0);
|
| +
|
| + [cell clearTrackingArea];
|
| + EXPECT_TRUE([cell mouseTrackingDecorations].empty());
|
| +
|
| + EXPECT_CALL(mock_right_decoration_, AcceptsMousePress())
|
| + .WillOnce(Return(true))
|
| + .WillRepeatedly(Return(true));
|
| +
|
| + [cell updateMouseTrackingAndToolTipsInRect:[field_ bounds] ofView:field_];
|
| + EXPECT_EQ([cell mouseTrackingDecorations].size(), 2.0);
|
| +}
|
| +
|
| // Verify that clicking a decoration that accepts mouse clicks does not focus
|
| // the Omnibox.
|
| TEST_F(AutocompleteTextFieldObserverTest,
|
| @@ -816,6 +848,7 @@ TEST_F(AutocompleteTextFieldObserverTest,
|
| .WillRepeatedly(testing::Return(true));
|
| interactive_decoration.SetVisible(true);
|
| [cell addLeftDecoration:&interactive_decoration];
|
| + [cell updateMouseTrackingAndToolTipsInRect:[field_ frame] ofView:field_];
|
| EXPECT_CALL(interactive_decoration, OnMousePressed(_, _))
|
| .WillRepeatedly(testing::Return(true));
|
|
|
|
|