| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/guid.h" | 5 #include "base/guid.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 10 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 10 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 address_wrapper.GetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER))); | 92 address_wrapper.GetInfo(AutofillType(PHONE_HOME_WHOLE_NUMBER))); |
| 93 EXPECT_FALSE(address_wrapper.GetDisplayText(&unused, &unused2)); | 93 EXPECT_FALSE(address_wrapper.GetDisplayText(&unused, &unused2)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 TEST(DataModelWrapperTest, GetDisplayText) { | 96 TEST(DataModelWrapperTest, GetDisplayText) { |
| 97 AutofillProfile profile = test::GetFullProfile(); | 97 AutofillProfile profile = test::GetFullProfile(); |
| 98 base::string16 vertical, horizontal; | 98 base::string16 vertical, horizontal; |
| 99 EXPECT_TRUE( | 99 EXPECT_TRUE( |
| 100 AutofillProfileWrapper(&profile).GetDisplayText(&horizontal, &vertical)); | 100 AutofillProfileWrapper(&profile).GetDisplayText(&horizontal, &vertical)); |
| 101 EXPECT_EQ( | 101 EXPECT_EQ( |
| 102 ASCIIToUTF16("John H. Doe, 666 Erebus St., Apt 8, Elysium, CA 91111\n" | 102 ASCIIToUTF16("John H. Doe, 666 Erebus St., Apt 8, Elysium CA 91111\n" |
| 103 "johndoe@hades.com\n" | 103 "johndoe@hades.com\n" |
| 104 "+1 650-211-1111"), | 104 "+1 650-211-1111"), |
| 105 horizontal); | 105 horizontal); |
| 106 EXPECT_EQ( | 106 EXPECT_EQ( |
| 107 ASCIIToUTF16("John H. Doe\n" | 107 ASCIIToUTF16("John H. Doe\n" |
| 108 "666 Erebus St.\n" | 108 "666 Erebus St.\n" |
| 109 "Apt 8\n" | 109 "Apt 8\n" |
| 110 "Elysium, CA 91111\n" | 110 "Elysium CA 91111\n" |
| 111 "johndoe@hades.com\n" | 111 "johndoe@hades.com\n" |
| 112 "+1 650-211-1111"), | 112 "+1 650-211-1111"), |
| 113 vertical); | 113 vertical); |
| 114 | 114 |
| 115 // A Japanese address. | 115 // A Japanese address. |
| 116 AutofillProfile foreign_profile( | 116 AutofillProfile foreign_profile( |
| 117 base::GenerateGUID(), "http://www.example.com/"); | 117 base::GenerateGUID(), "http://www.example.com/"); |
| 118 foreign_profile.SetRawInfo( | 118 foreign_profile.SetRawInfo( |
| 119 ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP")); | 119 ADDRESS_HOME_COUNTRY, ASCIIToUTF16("JP")); |
| 120 foreign_profile.SetRawInfo( | 120 foreign_profile.SetRawInfo( |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 profile_wrapper.GetInfoForDisplay( | 226 profile_wrapper.GetInfoForDisplay( |
| 227 AutofillType(PHONE_HOME_WHOLE_NUMBER))); | 227 AutofillType(PHONE_HOME_WHOLE_NUMBER))); |
| 228 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, user_formatted); | 228 profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, user_formatted); |
| 229 EXPECT_EQ(user_formatted, | 229 EXPECT_EQ(user_formatted, |
| 230 profile_wrapper.GetInfoForDisplay( | 230 profile_wrapper.GetInfoForDisplay( |
| 231 AutofillType(PHONE_HOME_WHOLE_NUMBER))); | 231 AutofillType(PHONE_HOME_WHOLE_NUMBER))); |
| 232 | 232 |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace autofill | 235 } // namespace autofill |
| OLD | NEW |