Index: chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm |
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm |
index 65241db81f5f773ab4af44ca823ec6f0b12e756d..00e7b62eafee98592a955691f85544758e7b74c3 100644 |
--- a/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm |
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm |
@@ -443,11 +443,22 @@ TEST_F(AutocompleteTextFieldCellTest, UsesPartialKeywordIfNarrow) { |
const NSString* kFullString = @"Search Engine:"; |
const NSString* kPartialString = @"Search Eng:"; |
- // Wide width chooses the full string. |
+ // Wide width chooses the full string, including an image on the |
+ // left. |
[cell setKeywordString:kFullString |
partialString:kPartialString |
availableWidth:kWidth]; |
EXPECT_TRUE([cell keywordString]); |
+ EXPECT_TRUE([[[cell keywordString] string] hasSuffix:kFullString]); |
+ EXPECT_TRUE([[cell keywordString] containsAttachments]); |
+ |
+ // If not enough space to include the image, uses exactly the full |
+ // string. |
+ CGFloat allWidth = [[cell keywordString] size].width; |
+ [cell setKeywordString:kFullString |
+ partialString:kPartialString |
+ availableWidth:allWidth - 5.0]; |
+ EXPECT_TRUE([cell keywordString]); |
EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kFullString]); |
// Narrow width chooses the partial string. |