| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "base/scoped_vector.h" | 7 #include "base/scoped_vector.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 std::vector<string16> labels; | 474 std::vector<string16> labels; |
| 475 AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, | 475 AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 3, |
| 476 &labels); | 476 &labels); |
| 477 ASSERT_EQ(3U, labels.size()); | 477 ASSERT_EQ(3U, labels.size()); |
| 478 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); | 478 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); |
| 479 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Ggoole"), labels[1]); | 479 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Ggoole"), labels[1]); |
| 480 EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com, Goolge"), labels[2]); | 480 EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com, Goolge"), labels[2]); |
| 481 | 481 |
| 482 // A field must have a non-empty value for each profile to be considered a | 482 // A field must have a non-empty value for each profile to be considered a |
| 483 // distinguishing field. | 483 // distinguishing field. |
| 484 profiles[1]->SetInfo(AutofillType(ADDRESS_HOME_LINE1), | 484 profiles[1]->SetInfo(ADDRESS_HOME_LINE1, |
| 485 ASCIIToUTF16("88 Nowhere Ave.")); | 485 ASCIIToUTF16("88 Nowhere Ave.")); |
| 486 AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 1, | 486 AutofillProfile::CreateInferredLabels(&profiles.get(), NULL, UNKNOWN_TYPE, 1, |
| 487 &labels); | 487 &labels); |
| 488 ASSERT_EQ(3U, labels.size()); | 488 ASSERT_EQ(3U, labels.size()); |
| 489 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); | 489 EXPECT_EQ(ASCIIToUTF16("John Doe, doe@example.com, Gogole"), labels[0]); |
| 490 EXPECT_EQ(ASCIIToUTF16("John Doe, 88 Nowhere Ave., doe@example.com, Ggoole"), | 490 EXPECT_EQ(ASCIIToUTF16("John Doe, 88 Nowhere Ave., doe@example.com, Ggoole"), |
| 491 labels[1]) << labels[1]; | 491 labels[1]) << labels[1]; |
| 492 EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com"), labels[2]); | 492 EXPECT_EQ(ASCIIToUTF16("John Doe, john.doe@example.com"), labels[2]); |
| 493 } | 493 } |
| 494 | 494 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 EXPECT_LT(0, b.Compare(a)); | 635 EXPECT_LT(0, b.Compare(a)); |
| 636 } | 636 } |
| 637 | 637 |
| 638 TEST(AutofillProfileTest, CountryCode) { | 638 TEST(AutofillProfileTest, CountryCode) { |
| 639 AutofillProfile profile; | 639 AutofillProfile profile; |
| 640 EXPECT_EQ(std::string(), profile.CountryCode()); | 640 EXPECT_EQ(std::string(), profile.CountryCode()); |
| 641 | 641 |
| 642 profile.SetCountryCode("US"); | 642 profile.SetCountryCode("US"); |
| 643 EXPECT_EQ("US", profile.CountryCode()); | 643 EXPECT_EQ("US", profile.CountryCode()); |
| 644 } | 644 } |
| OLD | NEW |