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 <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/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 // Simulate form submission. We should not call into the PDM to try to save | 2418 // Simulate form submission. We should not call into the PDM to try to save |
2419 // the filled data, since the filled form is effectively missing an address. | 2419 // the filled data, since the filled form is effectively missing an address. |
2420 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); | 2420 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); |
2421 FormSubmitted(response_data); | 2421 FormSubmitted(response_data); |
2422 } | 2422 } |
2423 | 2423 |
2424 // Checks that resetting the auxiliary profile enabled preference does the right | 2424 // Checks that resetting the auxiliary profile enabled preference does the right |
2425 // thing on all platforms. | 2425 // thing on all platforms. |
2426 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { | 2426 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { |
2427 PrefService* prefs = autofill_client_.GetPrefs(); | 2427 PrefService* prefs = autofill_client_.GetPrefs(); |
2428 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 2428 #if defined(OS_MACOSX) |
2429 // Auxiliary profiles is implemented on Mac and Android only. | 2429 // Auxiliary profiles is implemented on Mac only. |
2430 // OSX: This preference exists for legacy reasons. It is no longer used. | 2430 // OSX: This preference exists for legacy reasons. It is no longer used. |
2431 // Android: enables integration with user's contact profile. | |
2432 ASSERT_TRUE( | 2431 ASSERT_TRUE( |
2433 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); | 2432 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); |
2434 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, | 2433 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, |
2435 false); | 2434 false); |
2436 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); | 2435 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); |
2437 ASSERT_TRUE( | 2436 ASSERT_TRUE( |
2438 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); | 2437 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); |
2439 #else | 2438 #else |
2440 ASSERT_FALSE( | 2439 ASSERT_FALSE( |
2441 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); | 2440 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); |
2442 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); | 2441 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); |
2443 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); | 2442 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); |
2444 ASSERT_FALSE( | 2443 ASSERT_FALSE( |
2445 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); | 2444 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); |
2446 #endif // defined(OS_MACOSX) || defined(OS_ANDROID) | 2445 #endif // defined(OS_MACOSX) |
2447 } | 2446 } |
2448 | 2447 |
2449 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) { | 2448 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) { |
2450 FormData form; | 2449 FormData form; |
2451 form.name = ASCIIToUTF16("MyForm"); | 2450 form.name = ASCIIToUTF16("MyForm"); |
2452 form.origin = GURL("http://myform.com/form.html"); | 2451 form.origin = GURL("http://myform.com/form.html"); |
2453 form.action = GURL("http://myform.com/submit.html"); | 2452 form.action = GURL("http://myform.com/submit.html"); |
2454 form.user_submitted = true; | 2453 form.user_submitted = true; |
2455 | 2454 |
2456 std::vector<ServerFieldTypeSet> expected_types; | 2455 std::vector<ServerFieldTypeSet> expected_types; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2817 test::CreateTestAddressFormData(&form); | 2816 test::CreateTestAddressFormData(&form); |
2818 std::vector<FormData> forms(1, form); | 2817 std::vector<FormData> forms(1, form); |
2819 FormsSeen(forms); | 2818 FormsSeen(forms); |
2820 const FormFieldData& field = form.fields[0]; | 2819 const FormFieldData& field = form.fields[0]; |
2821 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 2820 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
2822 | 2821 |
2823 EXPECT_TRUE(external_delegate_->on_query_seen()); | 2822 EXPECT_TRUE(external_delegate_->on_query_seen()); |
2824 } | 2823 } |
2825 | 2824 |
2826 } // namespace autofill | 2825 } // namespace autofill |
OLD | NEW |