Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 301343002: mac: Clean up autofill integration with Address Book. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autofill_cleanup2_base
Patch Set: Autofill test failures on Android. Undo a change to autofill_test_utils.cc. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 FormData response_data; 1545 FormData response_data;
1546 FillAutofillFormDataAndSaveResults(kDefaultPageID, form, form.fields[0], 1546 FillAutofillFormDataAndSaveResults(kDefaultPageID, form, form.fields[0],
1547 PackGUIDs(empty, guid), &response_page_id, &response_data); 1547 PackGUIDs(empty, guid), &response_page_id, &response_data);
1548 ExpectFilledAddressFormElvis( 1548 ExpectFilledAddressFormElvis(
1549 response_page_id, response_data, kDefaultPageID, false); 1549 response_page_id, response_data, kDefaultPageID, false);
1550 } 1550 }
1551 1551
1552 // Test that we correctly fill an address form from an auxiliary profile. 1552 // Test that we correctly fill an address form from an auxiliary profile.
1553 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) { 1553 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) {
1554 personal_data_.ClearAutofillProfiles(); 1554 personal_data_.ClearAutofillProfiles();
1555 #if defined(OS_MACOSX) && !defined(OS_IOS)
1556 autofill_delegate_.GetPrefs()->SetBoolean(
1557 ::autofill::prefs::kAutofillUseMacAddressBook, true);
1558 #else
1555 autofill_delegate_.GetPrefs()->SetBoolean( 1559 autofill_delegate_.GetPrefs()->SetBoolean(
1556 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); 1560 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true);
1561 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
1562
1557 personal_data_.CreateTestAuxiliaryProfiles(); 1563 personal_data_.CreateTestAuxiliaryProfiles();
1558 1564
1559 // Set up our form data. 1565 // Set up our form data.
1560 FormData form; 1566 FormData form;
1561 test::CreateTestAddressFormData(&form); 1567 test::CreateTestAddressFormData(&form);
1562 std::vector<FormData> forms(1, form); 1568 std::vector<FormData> forms(1, form);
1563 FormsSeen(forms); 1569 FormsSeen(forms);
1564 1570
1565 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0); 1571 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0);
1566 GUIDPair empty(std::string(), 0); 1572 GUIDPair empty(std::string(), 0);
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); 2478 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0);
2473 FormSubmitted(response_data); 2479 FormSubmitted(response_data);
2474 } 2480 }
2475 2481
2476 // Checks that resetting the auxiliary profile enabled preference does the right 2482 // Checks that resetting the auxiliary profile enabled preference does the right
2477 // thing on all platforms. 2483 // thing on all platforms.
2478 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { 2484 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) {
2479 PrefService* prefs = autofill_delegate_.GetPrefs(); 2485 PrefService* prefs = autofill_delegate_.GetPrefs();
2480 #if defined(OS_MACOSX) || defined(OS_ANDROID) 2486 #if defined(OS_MACOSX) || defined(OS_ANDROID)
2481 // Auxiliary profiles is implemented on Mac and Android only. 2487 // Auxiliary profiles is implemented on Mac and Android only.
2482 // OSX: enables Mac Address Book integration. 2488 // OSX: This preference exists for legacy reasons. It is no longer used.
2483 // Android: enables integration with user's contact profile. 2489 // Android: enables integration with user's contact profile.
2484 ASSERT_TRUE( 2490 ASSERT_TRUE(
2485 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); 2491 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
2486 prefs->SetBoolean( 2492 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled,
2487 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false); 2493 false);
2488 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); 2494 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
2489 ASSERT_TRUE( 2495 ASSERT_TRUE(
2490 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); 2496 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
2491 #else 2497 #else
2492 ASSERT_FALSE( 2498 ASSERT_FALSE(
2493 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); 2499 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
2494 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); 2500 prefs->SetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true);
2495 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); 2501 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
2496 ASSERT_FALSE( 2502 ASSERT_FALSE(
2497 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); 2503 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
2498 #endif 2504 #endif // defined(OS_MACOSX) || defined(OS_ANDROID)
2499 } 2505 }
2500 2506
2501 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) { 2507 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUpload) {
2502 FormData form; 2508 FormData form;
2503 form.name = ASCIIToUTF16("MyForm"); 2509 form.name = ASCIIToUTF16("MyForm");
2504 form.method = ASCIIToUTF16("POST"); 2510 form.method = ASCIIToUTF16("POST");
2505 form.origin = GURL("http://myform.com/form.html"); 2511 form.origin = GURL("http://myform.com/form.html");
2506 form.action = GURL("http://myform.com/submit.html"); 2512 form.action = GURL("http://myform.com/submit.html");
2507 form.user_submitted = true; 2513 form.user_submitted = true;
2508 2514
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 test::CreateTestAddressFormData(&form); 2876 test::CreateTestAddressFormData(&form);
2871 std::vector<FormData> forms(1, form); 2877 std::vector<FormData> forms(1, form);
2872 FormsSeen(forms); 2878 FormsSeen(forms);
2873 const FormFieldData& field = form.fields[0]; 2879 const FormFieldData& field = form.fields[0];
2874 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2880 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2875 2881
2876 EXPECT_TRUE(external_delegate_->on_query_seen()); 2882 EXPECT_TRUE(external_delegate_->on_query_seen());
2877 } 2883 }
2878 2884
2879 } // namespace autofill 2885 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/autofill_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698