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

Side by Side Diff: chrome/browser/autofill/name_field_unittest.cc

Issue 3127030: AutoFill address profile not seen in dropdown for name and address field on dell.com (Closed)
Patch Set: Addressing nit. Created 10 years, 4 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
« no previous file with comments | « chrome/browser/autofill/name_field.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/scoped_vector.h" 6 #include "base/scoped_vector.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autofill/autofill_field.h" 8 #include "chrome/browser/autofill/autofill_field.h"
9 #include "chrome/browser/autofill/name_field.h" 9 #include "chrome/browser/autofill/name_field.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 string16(), 314 string16(),
315 ASCIIToUTF16("text"), 315 ASCIIToUTF16("text"),
316 0), 316 0),
317 ASCIIToUTF16("name2"))); 317 ASCIIToUTF16("name2")));
318 list_.push_back(NULL); 318 list_.push_back(NULL);
319 iter_ = list_.begin(); 319 iter_ = list_.begin();
320 field_.reset(NameField::Parse(&iter_, false)); 320 field_.reset(NameField::Parse(&iter_, false));
321 ASSERT_EQ(static_cast<NameField*>(NULL), field_.get()); 321 ASSERT_EQ(static_cast<NameField*>(NULL), field_.get());
322 } 322 }
323 323
324 // This case is from the dell.com checkout page. The middle initial "mi" string
325 // came at the end following other descriptive text. http://crbug.com/45123.
326 TEST_F(NameFieldTest, MiddleInitialAtEnd) {
327 list_.push_back(
328 new AutoFillField(webkit_glue::FormField(string16(),
329 ASCIIToUTF16("XXXnameXXXfirst"),
330 string16(),
331 ASCIIToUTF16("text"),
332 0),
333 ASCIIToUTF16("name1")));
334 list_.push_back(
335 new AutoFillField(webkit_glue::FormField(string16(),
336 ASCIIToUTF16("XXXnameXXXmi"),
337 string16(),
338 ASCIIToUTF16("text"),
339 0),
340 ASCIIToUTF16("name2")));
341 list_.push_back(
342 new AutoFillField(webkit_glue::FormField(string16(),
343 ASCIIToUTF16("XXXnameXXXlast"),
344 string16(),
345 ASCIIToUTF16("text"),
346 0),
347 ASCIIToUTF16("name3")));
348 list_.push_back(NULL);
349 iter_ = list_.begin();
350 field_.reset(NameField::Parse(&iter_, false));
351 ASSERT_NE(static_cast<NameField*>(NULL), field_.get());
352 ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
353 ASSERT_TRUE(
354 field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end());
355 EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]);
356 ASSERT_TRUE(
357 field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end());
358 EXPECT_EQ(NAME_MIDDLE_INITIAL, field_type_map_[ASCIIToUTF16("name2")]);
359 ASSERT_TRUE(
360 field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end());
361 EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]);
362 }
363
324 TEST_F(NameFieldTest, ECMLNoName) { 364 TEST_F(NameFieldTest, ECMLNoName) {
325 list_.push_back(new AutoFillField( 365 list_.push_back(new AutoFillField(
326 webkit_glue::FormField(ASCIIToUTF16("Company"), 366 webkit_glue::FormField(ASCIIToUTF16("Company"),
327 ASCIIToUTF16("ecom_shipto_postal_company"), 367 ASCIIToUTF16("ecom_shipto_postal_company"),
328 string16(), 368 string16(),
329 ASCIIToUTF16("text"), 369 ASCIIToUTF16("text"),
330 0), 370 0),
331 ASCIIToUTF16("field1"))); 371 ASCIIToUTF16("field1")));
332 list_.push_back(NULL); 372 list_.push_back(NULL);
333 iter_ = list_.begin(); 373 iter_ = list_.begin();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]); 428 EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]);
389 ASSERT_TRUE( 429 ASSERT_TRUE(
390 field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end()); 430 field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end());
391 EXPECT_EQ(NAME_MIDDLE, field_type_map_[ASCIIToUTF16("name2")]); 431 EXPECT_EQ(NAME_MIDDLE, field_type_map_[ASCIIToUTF16("name2")]);
392 ASSERT_TRUE( 432 ASSERT_TRUE(
393 field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end()); 433 field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end());
394 EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]); 434 EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]);
395 } 435 }
396 436
397 } // namespace 437 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/autofill/name_field.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698