| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 1913 |
| 1914 int page_id = 0; | 1914 int page_id = 0; |
| 1915 FormData results; | 1915 FormData results; |
| 1916 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 1916 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 1917 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); | 1917 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 // Test that we correctly fill an address form from an auxiliary profile. | 1920 // Test that we correctly fill an address form from an auxiliary profile. |
| 1921 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) { | 1921 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) { |
| 1922 personal_data_.ClearAutofillProfiles(); | 1922 personal_data_.ClearAutofillProfiles(); |
| 1923 PrefService* prefs = components::UserPrefs::Get(profile()); | 1923 PrefService* prefs = user_prefs::UserPrefs::Get(profile()); |
| 1924 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); | 1924 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); |
| 1925 personal_data_.CreateTestAuxiliaryProfiles(); | 1925 personal_data_.CreateTestAuxiliaryProfiles(); |
| 1926 | 1926 |
| 1927 // Set up our form data. | 1927 // Set up our form data. |
| 1928 FormData form; | 1928 FormData form; |
| 1929 CreateTestAddressFormData(&form); | 1929 CreateTestAddressFormData(&form); |
| 1930 std::vector<FormData> forms(1, form); | 1930 std::vector<FormData> forms(1, form); |
| 1931 FormsSeen(forms); | 1931 FormsSeen(forms); |
| 1932 | 1932 |
| 1933 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0); | 1933 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 | 2806 |
| 2807 // Simulate form submission. We should not call into the PDM to try to save | 2807 // Simulate form submission. We should not call into the PDM to try to save |
| 2808 // the filled data, since the filled form is effectively missing an address. | 2808 // the filled data, since the filled form is effectively missing an address. |
| 2809 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); | 2809 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); |
| 2810 FormSubmitted(results); | 2810 FormSubmitted(results); |
| 2811 } | 2811 } |
| 2812 | 2812 |
| 2813 // Checks that resetting the auxiliary profile enabled preference does the right | 2813 // Checks that resetting the auxiliary profile enabled preference does the right |
| 2814 // thing on all platforms. | 2814 // thing on all platforms. |
| 2815 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { | 2815 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { |
| 2816 PrefService* prefs = components::UserPrefs::Get(profile()); | 2816 PrefService* prefs = user_prefs::UserPrefs::Get(profile()); |
| 2817 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 2817 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 2818 // Auxiliary profiles is implemented on Mac and Android only. | 2818 // Auxiliary profiles is implemented on Mac and Android only. |
| 2819 // OSX: enables Mac Address Book integration. | 2819 // OSX: enables Mac Address Book integration. |
| 2820 // Android: enables integration with user's contact profile. | 2820 // Android: enables integration with user's contact profile. |
| 2821 ASSERT_TRUE( | 2821 ASSERT_TRUE( |
| 2822 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); | 2822 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); |
| 2823 prefs->SetBoolean( | 2823 prefs->SetBoolean( |
| 2824 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false); | 2824 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false); |
| 2825 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); | 2825 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); |
| 2826 ASSERT_TRUE( | 2826 ASSERT_TRUE( |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 CreateTestAddressFormData(&form); | 3280 CreateTestAddressFormData(&form); |
| 3281 std::vector<FormData> forms(1, form); | 3281 std::vector<FormData> forms(1, form); |
| 3282 FormsSeen(forms); | 3282 FormsSeen(forms); |
| 3283 const FormFieldData& field = form.fields[0]; | 3283 const FormFieldData& field = form.fields[0]; |
| 3284 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 3284 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
| 3285 | 3285 |
| 3286 autofill_manager_->SetExternalDelegate(NULL); | 3286 autofill_manager_->SetExternalDelegate(NULL); |
| 3287 } | 3287 } |
| 3288 | 3288 |
| 3289 } // namespace autofill | 3289 } // namespace autofill |
| OLD | NEW |