Chromium Code Reviews| 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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "base/string16.h" | 6 #include "base/string16.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "components/autofill/browser/android/auxiliary_profile_loader_android.h " | 8 #include "components/autofill/browser/android/auxiliary_profile_loader_android.h " |
| 9 #include "components/autofill/browser/android/auxiliary_profiles_android.h" | 9 #include "components/autofill/browser/android/auxiliary_profiles_android.h" |
| 10 #include "components/autofill/browser/android/test_auxiliary_profile_loader_andr oid.h" | 10 #include "components/autofill/browser/android/test_auxiliary_profile_loader_andr oid.h" |
| 11 #include "components/autofill/browser/autofill_profile.h" | 11 #include "components/autofill/browser/autofill_profile.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 class AuxiliaryProfileAndroidTest : public testing::Test { | 14 class AuxiliaryProfileAndroidTest : public testing::Test { |
| 15 public: | 15 public: |
| 16 AuxiliaryProfileAndroidTest() {} | 16 AuxiliaryProfileAndroidTest() {} |
| 17 | 17 |
| 18 AutofillProfile* GetAndLoadProfile() { | 18 AutofillProfile* GetAndLoadProfile() { |
| 19 autofill::AuxiliaryProfilesAndroid impl(profile_loader_); | 19 autofill::AuxiliaryProfilesAndroid impl(profile_loader_, "en-US"); |
| 20 profile_ = impl.LoadContactsProfile(); | 20 profile_ = impl.LoadContactsProfile(); |
| 21 return profile_.get(); | 21 return profile_.get(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 TestAuxiliaryProfileLoader& profile_loader() { | 24 TestAuxiliaryProfileLoader& profile_loader() { |
| 25 return profile_loader_; | 25 return profile_loader_; |
| 26 } | 26 } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 TestAuxiliaryProfileLoader profile_loader_; | 29 TestAuxiliaryProfileLoader profile_loader_; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 // Disable address population tests until we implement a way to parse the | 102 // Disable address population tests until we implement a way to parse the |
| 103 // data. | 103 // data. |
| 104 // | 104 // |
| 105 | 105 |
| 106 #if 0 | 106 #if 0 |
| 107 TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfo) { | 107 TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfo) { |
| 108 string16 street = ASCIIToUTF16("221 B Baker Street"); | 108 string16 street = ASCIIToUTF16("221 B Baker Street"); |
| 109 string16 city = ASCIIToUTF16("London"); | 109 string16 city = ASCIIToUTF16("London"); |
| 110 string16 postal_code = ASCIIToUTF16("123456"); | 110 string16 postal_code = ASCIIToUTF16("123456"); |
| 111 string16 region = ASCIIToUTF16("Georgian Terrace"); | 111 string16 region = ASCIIToUTF16("Georgian Terrace"); |
| 112 string16 country = ASCIIToUTF16("England"); | 112 string16 country = ASCIIToUTF16("GB"); |
|
Ilya Sherman
2013/04/05 05:18:01
Please preserve the string "England" here -- this
jam
2013/04/05 06:45:54
Done.
| |
| 113 | 113 |
| 114 profile_loader().SetStreet(street); | 114 profile_loader().SetStreet(street); |
| 115 profile_loader().SetCity(city); | 115 profile_loader().SetCity(city); |
| 116 profile_loader().SetPostalCode(postal_code); | 116 profile_loader().SetPostalCode(postal_code); |
| 117 profile_loader().SetRegion(region); | 117 profile_loader().SetRegion(region); |
| 118 profile_loader().SetCountry(country); | 118 profile_loader().SetCountry(country); |
| 119 | 119 |
| 120 AutofillProfile* profile = GetAndLoadProfile(); | 120 AutofillProfile* profile = GetAndLoadProfile(); |
| 121 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), street); | 121 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), street); |
| 122 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), city); | 122 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), city); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 150 TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfoEmpty) { | 150 TEST_F(AuxiliaryProfileAndroidTest, SetAddressInfoEmpty) { |
| 151 AutofillProfile* profile = GetAndLoadProfile(); | 151 AutofillProfile* profile = GetAndLoadProfile(); |
| 152 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), string16()); | 152 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE1), string16()); |
| 153 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE2), string16()); | 153 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_LINE2), string16()); |
| 154 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), string16()); | 154 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_CITY), string16()); |
| 155 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_ZIP), string16()); | 155 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_ZIP), string16()); |
| 156 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_STATE), string16()); | 156 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_STATE), string16()); |
| 157 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_COUNTRY), string16()); | 157 EXPECT_EQ(profile->GetRawInfo(ADDRESS_HOME_COUNTRY), string16()); |
| 158 } | 158 } |
| 159 #endif | 159 #endif |
| OLD | NEW |