Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_view_mac_unittest.mm

Issue 6256010: Revert 72380 - Remove wstring from autocomplete.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete/autocomplete.h" 10 #include "chrome/browser/autocomplete/autocomplete.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 longestEffectiveRange:&range inRange:fullRange]; 79 longestEffectiveRange:&range inRange:fullRange];
80 NSFontManager* fontManager = [NSFontManager sharedFontManager]; 80 NSFontManager* fontManager = [NSFontManager sharedFontManager];
81 if (runFont && (mask == ([fontManager traitsOfFont:runFont]&mask))) { 81 if (runFont && (mask == ([fontManager traitsOfFont:runFont]&mask))) {
82 return true; 82 return true;
83 } 83 }
84 return false; 84 return false;
85 } 85 }
86 86
87 // AutocompleteMatch doesn't really have the right constructor for our 87 // AutocompleteMatch doesn't really have the right constructor for our
88 // needs. Fake one for us to use. 88 // needs. Fake one for us to use.
89 static AutocompleteMatch MakeMatch(const string16 &contents, 89 static AutocompleteMatch MakeMatch(const std::wstring &contents,
90 const string16 &description) { 90 const std::wstring &description) {
91 AutocompleteMatch m(NULL, 1, true, AutocompleteMatch::URL_WHAT_YOU_TYPED); 91 AutocompleteMatch m(NULL, 1, true, AutocompleteMatch::URL_WHAT_YOU_TYPED);
92 m.contents = contents; 92 m.contents = contents;
93 m.description = description; 93 m.description = description;
94 return m; 94 return m;
95 } 95 }
96 96
97 NSColor* color_; // weak 97 NSColor* color_; // weak
98 NSColor* dimColor_; // weak 98 NSColor* dimColor_; // weak
99 gfx::Font font_; 99 gfx::Font font_;
100 }; 100 };
101 101
102 // Simple inputs with no matches should result in styled output who's 102 // Simple inputs with no matches should result in styled output who's
103 // text matches the input string, with the passed-in color, and 103 // text matches the input string, with the passed-in color, and
104 // nothing bolded. 104 // nothing bolded.
105 TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringNoMatch) { 105 TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringNoMatch) {
106 NSString* const string = @"This is a test"; 106 NSString* const string = @"This is a test";
107 AutocompleteMatch::ACMatchClassifications classifications; 107 AutocompleteMatch::ACMatchClassifications classifications;
108 108
109 NSAttributedString* decorated = 109 NSAttributedString* decorated =
110 AutocompletePopupViewMac::DecorateMatchedString( 110 AutocompletePopupViewMac::DecorateMatchedString(
111 base::SysNSStringToUTF16(string), classifications, 111 base::SysNSStringToWide(string), classifications,
112 color_, dimColor_, font_); 112 color_, dimColor_, font_);
113 113
114 // Result has same characters as the input. 114 // Result has same characters as the input.
115 EXPECT_EQ([decorated length], [string length]); 115 EXPECT_EQ([decorated length], [string length]);
116 EXPECT_TRUE([[decorated string] isEqualToString:string]); 116 EXPECT_TRUE([[decorated string] isEqualToString:string]);
117 117
118 // Our passed-in color for the entire string. 118 // Our passed-in color for the entire string.
119 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 119 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
120 NSForegroundColorAttributeName), 120 NSForegroundColorAttributeName),
121 [string length]); 121 [string length]);
122 EXPECT_TRUE(RunHasColor(decorated, 0U, color_)); 122 EXPECT_TRUE(RunHasColor(decorated, 0U, color_));
123 123
124 // An unbolded font for the entire string. 124 // An unbolded font for the entire string.
125 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 125 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
126 NSFontAttributeName), [string length]); 126 NSFontAttributeName), [string length]);
127 EXPECT_FALSE(RunHasFontTrait(decorated, 0U, NSBoldFontMask)); 127 EXPECT_FALSE(RunHasFontTrait(decorated, 0U, NSBoldFontMask));
128 } 128 }
129 129
130 // Identical to DecorateMatchedStringNoMatch, except test that URL 130 // Identical to DecorateMatchedStringNoMatch, except test that URL
131 // style gets a different color than we passed in. 131 // style gets a different color than we passed in.
132 TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLNoMatch) { 132 TEST_F(AutocompletePopupViewMacTest, DecorateMatchedStringURLNoMatch) {
133 NSString* const string = @"This is a test"; 133 NSString* const string = @"This is a test";
134 AutocompleteMatch::ACMatchClassifications classifications; 134 AutocompleteMatch::ACMatchClassifications classifications;
135 135
136 classifications.push_back( 136 classifications.push_back(
137 ACMatchClassification(0, ACMatchClassification::URL)); 137 ACMatchClassification(0, ACMatchClassification::URL));
138 138
139 NSAttributedString* decorated = 139 NSAttributedString* decorated =
140 AutocompletePopupViewMac::DecorateMatchedString( 140 AutocompletePopupViewMac::DecorateMatchedString(
141 base::SysNSStringToUTF16(string), classifications, 141 base::SysNSStringToWide(string), classifications,
142 color_, dimColor_, font_); 142 color_, dimColor_, font_);
143 143
144 // Result has same characters as the input. 144 // Result has same characters as the input.
145 EXPECT_EQ([decorated length], [string length]); 145 EXPECT_EQ([decorated length], [string length]);
146 EXPECT_TRUE([[decorated string] isEqualToString:string]); 146 EXPECT_TRUE([[decorated string] isEqualToString:string]);
147 147
148 // One color for the entire string, and it's not the one we passed in. 148 // One color for the entire string, and it's not the one we passed in.
149 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 149 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
150 NSForegroundColorAttributeName), 150 NSForegroundColorAttributeName),
151 [string length]); 151 [string length]);
(...skipping 18 matching lines...) Expand all
170 classifications.push_back( 170 classifications.push_back(
171 ACMatchClassification(0, ACMatchClassification::NONE)); 171 ACMatchClassification(0, ACMatchClassification::NONE));
172 classifications.push_back( 172 classifications.push_back(
173 ACMatchClassification(runLength1, ACMatchClassification::DIM)); 173 ACMatchClassification(runLength1, ACMatchClassification::DIM));
174 classifications.push_back( 174 classifications.push_back(
175 ACMatchClassification(runLength1 + runLength2, 175 ACMatchClassification(runLength1 + runLength2,
176 ACMatchClassification::NONE)); 176 ACMatchClassification::NONE));
177 177
178 NSAttributedString* decorated = 178 NSAttributedString* decorated =
179 AutocompletePopupViewMac::DecorateMatchedString( 179 AutocompletePopupViewMac::DecorateMatchedString(
180 base::SysNSStringToUTF16(string), classifications, 180 base::SysNSStringToWide(string), classifications,
181 color_, dimColor_, font_); 181 color_, dimColor_, font_);
182 182
183 // Result has same characters as the input. 183 // Result has same characters as the input.
184 EXPECT_EQ([decorated length], [string length]); 184 EXPECT_EQ([decorated length], [string length]);
185 EXPECT_TRUE([[decorated string] isEqualToString:string]); 185 EXPECT_TRUE([[decorated string] isEqualToString:string]);
186 186
187 // Should have three font runs, normal, dim, normal. 187 // Should have three font runs, normal, dim, normal.
188 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 188 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
189 NSForegroundColorAttributeName), 189 NSForegroundColorAttributeName),
190 runLength1); 190 runLength1);
(...skipping 29 matching lines...) Expand all
220 classifications.push_back( 220 classifications.push_back(
221 ACMatchClassification(0, ACMatchClassification::NONE)); 221 ACMatchClassification(0, ACMatchClassification::NONE));
222 classifications.push_back( 222 classifications.push_back(
223 ACMatchClassification(runLength1, ACMatchClassification::MATCH)); 223 ACMatchClassification(runLength1, ACMatchClassification::MATCH));
224 classifications.push_back( 224 classifications.push_back(
225 ACMatchClassification(runLength1 + runLength2, 225 ACMatchClassification(runLength1 + runLength2,
226 ACMatchClassification::NONE)); 226 ACMatchClassification::NONE));
227 227
228 NSAttributedString* decorated = 228 NSAttributedString* decorated =
229 AutocompletePopupViewMac::DecorateMatchedString( 229 AutocompletePopupViewMac::DecorateMatchedString(
230 base::SysNSStringToUTF16(string), classifications, 230 base::SysNSStringToWide(string), classifications,
231 color_, dimColor_, font_); 231 color_, dimColor_, font_);
232 232
233 // Result has same characters as the input. 233 // Result has same characters as the input.
234 EXPECT_EQ([decorated length], [string length]); 234 EXPECT_EQ([decorated length], [string length]);
235 EXPECT_TRUE([[decorated string] isEqualToString:string]); 235 EXPECT_TRUE([[decorated string] isEqualToString:string]);
236 236
237 // Our passed-in color for the entire string. 237 // Our passed-in color for the entire string.
238 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 238 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
239 NSForegroundColorAttributeName), 239 NSForegroundColorAttributeName),
240 [string length]); 240 [string length]);
(...skipping 27 matching lines...) Expand all
268 classifications.push_back( 268 classifications.push_back(
269 ACMatchClassification(0, ACMatchClassification::URL)); 269 ACMatchClassification(0, ACMatchClassification::URL));
270 const int kURLMatch = ACMatchClassification::URL|ACMatchClassification::MATCH; 270 const int kURLMatch = ACMatchClassification::URL|ACMatchClassification::MATCH;
271 classifications.push_back(ACMatchClassification(runLength1, kURLMatch)); 271 classifications.push_back(ACMatchClassification(runLength1, kURLMatch));
272 classifications.push_back( 272 classifications.push_back(
273 ACMatchClassification(runLength1 + runLength2, 273 ACMatchClassification(runLength1 + runLength2,
274 ACMatchClassification::URL)); 274 ACMatchClassification::URL));
275 275
276 NSAttributedString* decorated = 276 NSAttributedString* decorated =
277 AutocompletePopupViewMac::DecorateMatchedString( 277 AutocompletePopupViewMac::DecorateMatchedString(
278 base::SysNSStringToUTF16(string), classifications, 278 base::SysNSStringToWide(string), classifications,
279 color_, dimColor_, font_); 279 color_, dimColor_, font_);
280 280
281 // Result has same characters as the input. 281 // Result has same characters as the input.
282 EXPECT_EQ([decorated length], [string length]); 282 EXPECT_EQ([decorated length], [string length]);
283 EXPECT_TRUE([[decorated string] isEqualToString:string]); 283 EXPECT_TRUE([[decorated string] isEqualToString:string]);
284 284
285 // One color for the entire string, and it's not the one we passed in. 285 // One color for the entire string, and it's not the one we passed in.
286 EXPECT_EQ(RunLengthForAttribute(decorated, 0U, 286 EXPECT_EQ(RunLengthForAttribute(decorated, 0U,
287 NSForegroundColorAttributeName), 287 NSForegroundColorAttributeName),
288 [string length]); 288 [string length]);
(...skipping 14 matching lines...) Expand all
303 NSBoldFontMask)); 303 NSBoldFontMask));
304 } 304 }
305 305
306 // Check that matches with both contents and description come back 306 // Check that matches with both contents and description come back
307 // with contents at the beginning, description at the end, and 307 // with contents at the beginning, description at the end, and
308 // something separating them. Not being specific about the separator 308 // something separating them. Not being specific about the separator
309 // on purpose, in case it changes. 309 // on purpose, in case it changes.
310 TEST_F(AutocompletePopupViewMacTest, MatchText) { 310 TEST_F(AutocompletePopupViewMacTest, MatchText) {
311 NSString* const contents = @"contents"; 311 NSString* const contents = @"contents";
312 NSString* const description = @"description"; 312 NSString* const description = @"description";
313 AutocompleteMatch m = MakeMatch(base::SysNSStringToUTF16(contents), 313 AutocompleteMatch m = MakeMatch(base::SysNSStringToWide(contents),
314 base::SysNSStringToUTF16(description)); 314 base::SysNSStringToWide(description));
315 315
316 NSAttributedString* decorated = 316 NSAttributedString* decorated =
317 AutocompletePopupViewMac::MatchText(m, font_, kLargeWidth); 317 AutocompletePopupViewMac::MatchText(m, font_, kLargeWidth);
318 318
319 // Result contains the characters of the input in the right places. 319 // Result contains the characters of the input in the right places.
320 EXPECT_GT([decorated length], [contents length] + [description length]); 320 EXPECT_GT([decorated length], [contents length] + [description length]);
321 EXPECT_TRUE([[decorated string] hasPrefix:contents]); 321 EXPECT_TRUE([[decorated string] hasPrefix:contents]);
322 EXPECT_TRUE([[decorated string] hasSuffix:description]); 322 EXPECT_TRUE([[decorated string] hasSuffix:description]);
323 323
324 // Check that the description is a different color from the 324 // Check that the description is a different color from the
(...skipping 14 matching lines...) Expand all
339 } 339 }
340 340
341 // Check that MatchText() styles content matches as expected. 341 // Check that MatchText() styles content matches as expected.
342 TEST_F(AutocompletePopupViewMacTest, MatchTextContentsMatch) { 342 TEST_F(AutocompletePopupViewMacTest, MatchTextContentsMatch) {
343 NSString* const contents = @"This is a test"; 343 NSString* const contents = @"This is a test";
344 // Match "is". 344 // Match "is".
345 const NSUInteger runLength1 = 5, runLength2 = 2, runLength3 = 7; 345 const NSUInteger runLength1 = 5, runLength2 = 2, runLength3 = 7;
346 // Make sure nobody messed up the inputs. 346 // Make sure nobody messed up the inputs.
347 EXPECT_EQ(runLength1 + runLength2 + runLength3, [contents length]); 347 EXPECT_EQ(runLength1 + runLength2 + runLength3, [contents length]);
348 348
349 AutocompleteMatch m = MakeMatch(base::SysNSStringToUTF16(contents), 349 AutocompleteMatch m = MakeMatch(base::SysNSStringToWide(contents),
350 string16()); 350 std::wstring());
351 351
352 // Push each run onto contents classifications. 352 // Push each run onto contents classifications.
353 m.contents_class.push_back( 353 m.contents_class.push_back(
354 ACMatchClassification(0, ACMatchClassification::NONE)); 354 ACMatchClassification(0, ACMatchClassification::NONE));
355 m.contents_class.push_back( 355 m.contents_class.push_back(
356 ACMatchClassification(runLength1, ACMatchClassification::MATCH)); 356 ACMatchClassification(runLength1, ACMatchClassification::MATCH));
357 m.contents_class.push_back( 357 m.contents_class.push_back(
358 ACMatchClassification(runLength1 + runLength2, 358 ACMatchClassification(runLength1 + runLength2,
359 ACMatchClassification::NONE)); 359 ACMatchClassification::NONE));
360 360
(...skipping 26 matching lines...) Expand all
387 387
388 // Check that MatchText() styles description matches as expected. 388 // Check that MatchText() styles description matches as expected.
389 TEST_F(AutocompletePopupViewMacTest, MatchTextDescriptionMatch) { 389 TEST_F(AutocompletePopupViewMacTest, MatchTextDescriptionMatch) {
390 NSString* const contents = @"This is a test"; 390 NSString* const contents = @"This is a test";
391 NSString* const description = @"That was a test"; 391 NSString* const description = @"That was a test";
392 // Match "That was". 392 // Match "That was".
393 const NSUInteger runLength1 = 8, runLength2 = 7; 393 const NSUInteger runLength1 = 8, runLength2 = 7;
394 // Make sure nobody messed up the inputs. 394 // Make sure nobody messed up the inputs.
395 EXPECT_EQ(runLength1 + runLength2, [description length]); 395 EXPECT_EQ(runLength1 + runLength2, [description length]);
396 396
397 AutocompleteMatch m = MakeMatch(base::SysNSStringToUTF16(contents), 397 AutocompleteMatch m = MakeMatch(base::SysNSStringToWide(contents),
398 base::SysNSStringToUTF16(description)); 398 base::SysNSStringToWide(description));
399 399
400 // Push each run onto contents classifications. 400 // Push each run onto contents classifications.
401 m.description_class.push_back( 401 m.description_class.push_back(
402 ACMatchClassification(0, ACMatchClassification::MATCH)); 402 ACMatchClassification(0, ACMatchClassification::MATCH));
403 m.description_class.push_back( 403 m.description_class.push_back(
404 ACMatchClassification(runLength1, ACMatchClassification::NONE)); 404 ACMatchClassification(runLength1, ACMatchClassification::NONE));
405 405
406 NSAttributedString* decorated = 406 NSAttributedString* decorated =
407 AutocompletePopupViewMac::MatchText(m, font_, kLargeWidth); 407 AutocompletePopupViewMac::MatchText(m, font_, kLargeWidth);
408 408
(...skipping 25 matching lines...) Expand all
434 EXPECT_TRUE(RunHasFontTrait(decorated, descriptionLocation, NSBoldFontMask)); 434 EXPECT_TRUE(RunHasFontTrait(decorated, descriptionLocation, NSBoldFontMask));
435 435
436 EXPECT_EQ(RunLengthForAttribute(decorated, descriptionLocation + runLength1, 436 EXPECT_EQ(RunLengthForAttribute(decorated, descriptionLocation + runLength1,
437 NSFontAttributeName), runLength2); 437 NSFontAttributeName), runLength2);
438 EXPECT_FALSE(RunHasFontTrait(decorated, descriptionLocation + runLength1, 438 EXPECT_FALSE(RunHasFontTrait(decorated, descriptionLocation + runLength1,
439 NSBoldFontMask)); 439 NSBoldFontMask));
440 } 440 }
441 441
442 TEST_F(AutocompletePopupViewMacTest, ElideString) { 442 TEST_F(AutocompletePopupViewMacTest, ElideString) {
443 NSString* const contents = @"This is a test with long contents"; 443 NSString* const contents = @"This is a test with long contents";
444 const string16 contents16(base::SysNSStringToUTF16(contents)); 444 const std::wstring wideContents(base::SysNSStringToWide(contents));
445 445
446 const float kWide = 1000.0; 446 const float kWide = 1000.0;
447 const float kNarrow = 20.0; 447 const float kNarrow = 20.0;
448 448
449 NSDictionary* attributes = 449 NSDictionary* attributes =
450 [NSDictionary dictionaryWithObject:font_.GetNativeFont() 450 [NSDictionary dictionaryWithObject:font_.GetNativeFont()
451 forKey:NSFontAttributeName]; 451 forKey:NSFontAttributeName];
452 scoped_nsobject<NSMutableAttributedString> as( 452 scoped_nsobject<NSMutableAttributedString> as(
453 [[NSMutableAttributedString alloc] initWithString:contents 453 [[NSMutableAttributedString alloc] initWithString:contents
454 attributes:attributes]); 454 attributes:attributes]);
455 455
456 // Nothing happens if the space is really wide. 456 // Nothing happens if the space is really wide.
457 NSMutableAttributedString* ret = 457 NSMutableAttributedString* ret =
458 AutocompletePopupViewMac::ElideString(as, contents16, font_, kWide); 458 AutocompletePopupViewMac::ElideString(as, wideContents, font_, kWide);
459 EXPECT_TRUE(ret == as); 459 EXPECT_TRUE(ret == as);
460 EXPECT_TRUE([[as string] isEqualToString:contents]); 460 EXPECT_TRUE([[as string] isEqualToString:contents]);
461 461
462 // When elided, result is the same as ElideText(). 462 // When elided, result is the same as ElideText().
463 ret = AutocompletePopupViewMac::ElideString(as, contents16, font_, kNarrow); 463 ret = AutocompletePopupViewMac::ElideString(as, wideContents, font_, kNarrow);
464 string16 elided = ui::ElideText(contents16, font_, kNarrow, false); 464 std::wstring elided(UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(
465 wideContents), font_, kNarrow, false)));
465 EXPECT_TRUE(ret == as); 466 EXPECT_TRUE(ret == as);
466 EXPECT_FALSE([[as string] isEqualToString:contents]); 467 EXPECT_FALSE([[as string] isEqualToString:contents]);
467 EXPECT_TRUE([[as string] isEqualToString:base::SysUTF16ToNSString(elided)]); 468 EXPECT_TRUE([[as string] isEqualToString:base::SysWideToNSString(elided)]);
468 469
469 // When elided, result is the same as ElideText(). 470 // When elided, result is the same as ElideText().
470 ret = AutocompletePopupViewMac::ElideString(as, contents16, font_, 0.0); 471 ret = AutocompletePopupViewMac::ElideString(as, wideContents, font_, 0.0);
471 elided = ui::ElideText(contents16, font_, 0.0, false); 472 elided = UTF16ToWideHack(ui::ElideText(WideToUTF16Hack(wideContents), font_,
473 0.0, false));
472 EXPECT_TRUE(ret == as); 474 EXPECT_TRUE(ret == as);
473 EXPECT_FALSE([[as string] isEqualToString:contents]); 475 EXPECT_FALSE([[as string] isEqualToString:contents]);
474 EXPECT_TRUE([[as string] isEqualToString:base::SysUTF16ToNSString(elided)]); 476 EXPECT_TRUE([[as string] isEqualToString:base::SysWideToNSString(elided)]);
475 } 477 }
476 478
477 TEST_F(AutocompletePopupViewMacTest, MatchTextElide) { 479 TEST_F(AutocompletePopupViewMacTest, MatchTextElide) {
478 NSString* const contents = @"This is a test with long contents"; 480 NSString* const contents = @"This is a test with long contents";
479 NSString* const description = @"That was a test"; 481 NSString* const description = @"That was a test";
480 // Match "long". 482 // Match "long".
481 const NSUInteger runLength1 = 20, runLength2 = 4, runLength3 = 9; 483 const NSUInteger runLength1 = 20, runLength2 = 4, runLength3 = 9;
482 // Make sure nobody messed up the inputs. 484 // Make sure nobody messed up the inputs.
483 EXPECT_EQ(runLength1 + runLength2 + runLength3, [contents length]); 485 EXPECT_EQ(runLength1 + runLength2 + runLength3, [contents length]);
484 486
485 AutocompleteMatch m = MakeMatch(base::SysNSStringToUTF16(contents), 487 AutocompleteMatch m = MakeMatch(base::SysNSStringToWide(contents),
486 base::SysNSStringToUTF16(description)); 488 base::SysNSStringToWide(description));
487 489
488 // Push each run onto contents classifications. 490 // Push each run onto contents classifications.
489 m.contents_class.push_back( 491 m.contents_class.push_back(
490 ACMatchClassification(0, ACMatchClassification::NONE)); 492 ACMatchClassification(0, ACMatchClassification::NONE));
491 m.contents_class.push_back( 493 m.contents_class.push_back(
492 ACMatchClassification(runLength1, ACMatchClassification::MATCH)); 494 ACMatchClassification(runLength1, ACMatchClassification::MATCH));
493 m.contents_class.push_back( 495 m.contents_class.push_back(
494 ACMatchClassification(runLength1 + runLength2, 496 ACMatchClassification(runLength1 + runLength2,
495 ACMatchClassification::URL)); 497 ACMatchClassification::URL));
496 498
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // updates the model's selection from the matrix before returning. 545 // updates the model's selection from the matrix before returning.
544 // Could possibly test that via -select:. 546 // Could possibly test that via -select:.
545 547
546 // TODO(shess): Test that AutocompleteButtonCell returns the right 548 // TODO(shess): Test that AutocompleteButtonCell returns the right
547 // background colors for on, highlighted, and neither. 549 // background colors for on, highlighted, and neither.
548 550
549 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized 551 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized
550 // and then sends -select: to the view. 552 // and then sends -select: to the view.
551 553
552 } // namespace 554 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_view_mac.mm ('k') | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698