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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/guid.h" | 6 #include "base/guid.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
846 TEST(AutofillProfileTest, SetInfoTrimsWhitespace) { | 846 TEST(AutofillProfileTest, SetInfoTrimsWhitespace) { |
847 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); | 847 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); |
848 | 848 |
849 profile.SetInfo(AutofillType(EMAIL_ADDRESS), | 849 profile.SetInfo(AutofillType(EMAIL_ADDRESS), |
850 ASCIIToUTF16("\tuser@example.com "), | 850 ASCIIToUTF16("\tuser@example.com "), |
851 "en-US"); | 851 "en-US"); |
852 EXPECT_EQ(ASCIIToUTF16("user@example.com"), | 852 EXPECT_EQ(ASCIIToUTF16("user@example.com"), |
853 profile.GetRawInfo(EMAIL_ADDRESS)); | 853 profile.GetRawInfo(EMAIL_ADDRESS)); |
854 } | 854 } |
855 | 855 |
856 TEST(AutofillProfileTest, FullAddress) { | |
857 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); | |
858 test::SetProfileInfo(&profile, "Marion", "Mitchell", "Morrison", | |
859 "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", | |
860 "Hollywood", "CA", "91601", "US", | |
861 "12345678910"); | |
862 | |
863 AutofillType full_address(HTML_TYPE_FULL_ADDRESS, HTML_MODE_NONE); | |
864 base::string16 formatted_address(ASCIIToUTF16( | |
865 "Marion Mitchell Morrison\n" | |
866 "123 Zoo St.\n" | |
867 "unit 5\n" | |
868 "Hollywood, CA 91601")); | |
869 EXPECT_EQ(formatted_address, profile.GetInfo(full_address, "en-US")); | |
870 // This should fail and leave the profile unchanged. | |
871 EXPECT_FALSE(profile.SetInfo(full_address, ASCIIToUTF16("foobar"), "en-US")); | |
872 EXPECT_EQ(formatted_address, profile.GetInfo(full_address, "en-US")); | |
873 } | |
Ilya Sherman
2014/05/07 01:19:19
Please add a test for getting the full address fro
| |
874 | |
856 } // namespace autofill | 875 } // namespace autofill |
OLD | NEW |