diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 20:02:29 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 20:02:29 +0000 |
commit | 468327f532d9d061ebbd4ea3baeea9b914cb352d (patch) | |
tree | af4a9ccb4440ea2b12b8b6193ec274b6a0eed755 | |
parent | a23390092363b04a55f2f028a1425291828ea4ba (diff) | |
download | chromium_src-468327f532d9d061ebbd4ea3baeea9b914cb352d.zip chromium_src-468327f532d9d061ebbd4ea3baeea9b914cb352d.tar.gz chromium_src-468327f532d9d061ebbd4ea3baeea9b914cb352d.tar.bz2 |
Autofill browsertest
BUG=none
TEST=interactive_ui_tests --gtest_filter=AutofillTest.*
Review URL: http://codereview.chromium.org/3492009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61407 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed, 507 insertions, 305 deletions
diff --git a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm index adab6aa..3cf29c8 100644 --- a/chrome/browser/autofill/autofill_address_model_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_address_model_mac_unittest.mm @@ -5,7 +5,7 @@ #include "base/scoped_nsobject.h" #include "base/utf_string_conversions.h" #import "chrome/browser/autofill/autofill_address_model_mac.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/cocoa/browser_test_helper.h" #import "chrome/browser/cocoa/cocoa_test_helper.h" @@ -26,7 +26,7 @@ TEST(AutoFillAddressModelTest, Basic) { TEST(AutoFillAddressModelTest, InitializationFromProfile) { AutoFillProfile profile(ASCIIToUTF16("Home"), 0); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( &profile, "Billing", "Marion", @@ -60,7 +60,7 @@ TEST(AutoFillAddressModelTest, InitializationFromProfile) { TEST(AutoFillAddressModelTest, CopyModelToProfile) { AutoFillProfile profile(ASCIIToUTF16("Home"), 0); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( &profile, "Billing", "Marion", diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc new file mode 100644 index 0000000..04fdbfe --- /dev/null +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -0,0 +1,150 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <string> + +#include "app/keyboard_code_conversion.h" +#include "base/basictypes.h" +#include "base/ref_counted.h" +#include "base/scoped_ptr.h" +#include "base/string16.h" +#include "chrome/browser/autofill/autofill_common_test.h" +#include "chrome/browser/autofill/autofill_profile.h" +#include "chrome/browser/autofill/personal_data_manager.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/browser_window.h" +#include "chrome/browser/net/predictor_api.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/pref_names.h" +#include "chrome/test/in_process_browser_test.h" +#include "chrome/test/ui_test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" + +class AutoFillTest : public InProcessBrowserTest { + protected: + AutoFillTest() { + set_show_window(true); + EnableDOMAutomation(); + } + + void SetUpProfile() { + autofill_test::DisableSystemServices(browser()->profile()); + + AutoFillProfile profile(string16(), 0); + autofill_test::SetProfileInfo( + &profile, "Office Space", "Milton", "C.", "Waddams", + "red.swingline@initech.com", "Initech", "4120 Freidrich Lane", + "Basement", "Austin", "Texas", "78744", "United States", "5125551234", + "5125550000"); + + PersonalDataManager* personal_data_manager = + browser()->profile()->GetPersonalDataManager(); + ASSERT_TRUE(personal_data_manager); + + std::vector<AutoFillProfile> profiles(1, profile); + personal_data_manager->SetProfiles(&profiles); + } + + void ExpectFieldValue(const std::wstring& field_name, + const std::string& expected_value) { + std::string value; + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( + browser()->GetSelectedTabContents()->render_view_host(), L"", + L"window.domAutomationController.send(" + L"document.getElementById('" + field_name + L"').value);", &value)); + EXPECT_EQ(expected_value, value); + } +}; + +// Test that basic form fill is working. +IN_PROC_BROWSER_TEST_F(AutoFillTest, BasicFormFill) { + SetUpProfile(); + + ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); + ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL( + browser(), GURL("data:text/html;charset=utf-8," + "<form action=\"http://www.google.com/\" method=\"POST\">" + "<label for=\"firstname\">First name:</label>" + " <input type=\"text\" id=\"firstname\" /><br />" + "<label for=\"lastname\">Last name:</label>" + " <input type=\"text\" id=\"lastname\" /><br />" + "<label for=\"address1\">Address line 1:</label>" + " <input type=\"text\" id=\"address1\" /><br />" + "<label for=\"address2\">Address line 2:</label>" + " <input type=\"text\" id=\"address2\" /><br />" + "<label for=\"city\">City:</label>" + " <input type=\"text\" id=\"city\" /><br />" + "<label for=\"state\">State:</label>" + " <select id=\"state\">" + " <option value=\"\" selected=\"yes\">--</option>" + " <option value=\"CA\">California</option>" + " <option value=\"TX\">Texas</option>" + " </select><br />" + "<label for=\"zip\">ZIP code:</label>" + " <input type=\"text\" id=\"zip\" /><br />" + "<label for=\"country\">Country:</label>" + " <select id=\"country\">" + " <option value=\"\" selected=\"yes\">--</option>" + " <option value=\"CA\">Canada</option>" + " <option value=\"US\">United States</option>" + " </select><br />" + "<label for=\"phone\">Phone number:</label>" + " <input type=\"text\" id=\"phone\" /><br />" + "</form>"))); + + ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), + VIEW_ID_TAB_CONTAINER)); + ASSERT_TRUE(ui_test_utils::IsViewFocused(browser(), + VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); + + RenderViewHost* render_view_host = + browser()->GetSelectedTabContents()->render_view_host(); + ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( + render_view_host, L"", L"document.getElementById('firstname').focus();")); + + // Start filling the first name field with "M" and wait for the popup to be + // shown. + ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( + browser(), app::VKEY_M, false, true, false, false, + NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + Source<RenderViewHost>(render_view_host))); + + // Press the down arrow to select the suggestion and preview the autofilled + // form. + ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( + browser(), app::VKEY_DOWN, false, false, false, false, + NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + Source<RenderViewHost>(render_view_host))); + + // The previewed values should not be accessible to JavaScript. + ExpectFieldValue(L"firstname", "M"); + ExpectFieldValue(L"lastname", ""); + ExpectFieldValue(L"address1", ""); + ExpectFieldValue(L"address2", ""); + ExpectFieldValue(L"city", ""); + ExpectFieldValue(L"state", ""); + ExpectFieldValue(L"zip", ""); + ExpectFieldValue(L"country", ""); + ExpectFieldValue(L"phone", ""); + // TODO(isherman): It would be nice to test that the previewed values are + // displayed: http://crbug.com/57220 + + // Press Enter to accept the autofill suggestions. + ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( + browser(), app::VKEY_RETURN, false, false, false, false, + NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + Source<RenderViewHost>(render_view_host))); + + // The form should be filled. + ExpectFieldValue(L"firstname", "Milton"); + ExpectFieldValue(L"lastname", "Waddams"); + ExpectFieldValue(L"address1", "4120 Freidrich Lane"); + ExpectFieldValue(L"address2", "Basement"); + ExpectFieldValue(L"city", "Austin"); + ExpectFieldValue(L"state", "TX"); + ExpectFieldValue(L"zip", "78744"); + ExpectFieldValue(L"country", "US"); + ExpectFieldValue(L"phone", "5125551234"); +} diff --git a/chrome/browser/autofill/autofill_common_unittest.cc b/chrome/browser/autofill/autofill_common_test.cc index bad2784..3c7c319 100644 --- a/chrome/browser/autofill/autofill_common_unittest.cc +++ b/chrome/browser/autofill/autofill_common_test.cc @@ -2,14 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/credit_card.h" +#include "chrome/browser/password_manager/encryptor.h" +#include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/profile.h" +#include "chrome/common/pref_names.h" #include "webkit/glue/form_field.h" -namespace autofill_unittest { +namespace autofill_test { void CreateTestFormField(const char* label, const char* name, @@ -63,4 +67,16 @@ void SetCreditCardInfo(CreditCard* credit_card, credit_card->set_billing_address_id(billing_address_id); } -} // namespace autofill_unittest +void DisableSystemServices(Profile* profile) { + // Use a mock Keychain rather than the OS one to store credit card data. +#if defined(OS_MACOSX) + Encryptor::UseMockKeychain(true); +#endif + + // Disable auxiliary profiles for unit testing. These reach out to system + // services on the Mac. + profile->GetPrefs()->SetBoolean(prefs::kAutoFillAuxiliaryProfilesEnabled, + false); +} + +} // namespace autofill_test diff --git a/chrome/browser/autofill/autofill_common_unittest.h b/chrome/browser/autofill/autofill_common_test.h index a53bf84..3b7b83e 100644 --- a/chrome/browser/autofill/autofill_common_unittest.h +++ b/chrome/browser/autofill/autofill_common_test.h @@ -2,19 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_UNITTEST_H_ -#define CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_UNITTEST_H_ +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ #pragma once class AutoFillProfile; class CreditCard; +class Profile; namespace webkit_glue { class FormField; } // namespace webkit_glue -// Common utilities shared amongst AutoFill unit tests. -namespace autofill_unittest { +// Common utilities shared amongst AutoFill tests. +namespace autofill_test { // Provides a quick way to populate a FormField with c-strings. void CreateTestFormField(const char* label, @@ -41,6 +42,11 @@ void SetCreditCardInfo(CreditCard* credit_card, const char* card_number, const char* expiration_month, const char* expiration_year, int billing_address_id); -} // namespace autofill_unittest +// TODO(isherman): We should do this automatically for all tests, not manually +// on a per-test basis: http://crbug.com/57221 +// Disables or mocks out code that would otherwise reach out to system services. +void DisableSystemServices(Profile* profile); -#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_UNITTEST_H_ +} // namespace autofill_test + +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_COMMON_TEST_H_ diff --git a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm index 6caab87..f90f7d1 100644 --- a/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm +++ b/chrome/browser/autofill/autofill_credit_card_model_mac_unittest.mm @@ -4,7 +4,7 @@ #include "base/scoped_nsobject.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" #include "chrome/browser/autofill/credit_card.h" #include "chrome/browser/cocoa/browser_test_helper.h" @@ -26,7 +26,7 @@ TEST(AutoFillCreditCardModelTest, Basic) { TEST(AutoFillCreditCardModelTest, InitializationFromCreditCard) { CreditCard credit_card(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "2010", 1); scoped_nsobject<AutoFillCreditCardModel> model( [[AutoFillCreditCardModel alloc] initWithCreditCard:credit_card]); @@ -41,7 +41,7 @@ TEST(AutoFillCreditCardModelTest, InitializationFromCreditCard) { TEST(AutoFillCreditCardModelTest, CopyModelToCreditCard) { CreditCard credit_card(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "2010", 1); scoped_nsobject<AutoFillCreditCardModel> model( [[AutoFillCreditCardModel alloc] initWithCreditCard:credit_card]); diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index c84d482..7cc9769 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -10,7 +10,7 @@ #include "base/string16.h" #include "base/tuple.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_manager.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/credit_card.h" @@ -62,44 +62,44 @@ class TestPersonalDataManager : public PersonalDataManager { private: void CreateTestAutoFillProfiles(ScopedVector<AutoFillProfile>* profiles) { AutoFillProfile* profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Home", "Elvis", "Aaron", - "Presley", "theking@gmail.com", "RCA", - "3734 Elvis Presley Blvd.", "Apt. 10", - "Memphis", "Tennessee", "38116", "USA", - "12345678901", ""); + autofill_test::SetProfileInfo(profile, "Home", "Elvis", "Aaron", + "Presley", "theking@gmail.com", "RCA", + "3734 Elvis Presley Blvd.", "Apt. 10", + "Memphis", "Tennessee", "38116", "USA", + "12345678901", ""); profile->set_unique_id(1); profiles->push_back(profile); profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Work", "Charles", "Hardin", - "Holley", "buddy@gmail.com", "Decca", - "123 Apple St.", "unit 6", "Lubbock", - "Texas", "79401", "USA", "23456789012", - ""); + autofill_test::SetProfileInfo(profile, "Work", "Charles", "Hardin", + "Holley", "buddy@gmail.com", "Decca", + "123 Apple St.", "unit 6", "Lubbock", + "Texas", "79401", "USA", "23456789012", + ""); profile->set_unique_id(2); profiles->push_back(profile); profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Empty", "", "", "", "", "", "", - "", "", "", "", "", "", ""); + autofill_test::SetProfileInfo(profile, "Empty", "", "", "", "", "", "", "", + "", "", "", "", "", ""); profile->set_unique_id(3); profiles->push_back(profile); } void CreateTestCreditCards(ScopedVector<CreditCard>* credit_cards) { CreditCard* credit_card = new CreditCard; - autofill_unittest::SetCreditCardInfo(credit_card, "First", "Elvis Presley", - "Visa", "1234567890123456", "04", - "2012", 1); + autofill_test::SetCreditCardInfo(credit_card, "First", "Elvis Presley", + "Visa", "1234567890123456", + "04", "2012", 1); credit_card->set_unique_id(4); credit_cards->push_back(credit_card); credit_card = new CreditCard; - autofill_unittest::SetCreditCardInfo(credit_card, "Second", "Buddy Holly", - "Mastercard", "0987654321098765", "10", - "2014", 2); + autofill_test::SetCreditCardInfo(credit_card, "Second", "Buddy Holly", + "Mastercard", "0987654321098765", + "10", "2014", 2); credit_card->set_unique_id(5); credit_cards->push_back(credit_card); credit_card = new CreditCard; - autofill_unittest::SetCreditCardInfo(credit_card, "Empty", "", "", "", "", - "", 3); + autofill_test::SetCreditCardInfo(credit_card, "Empty", "", "", "", "", "", + 3); credit_card->set_unique_id(6); credit_cards->push_back(credit_card); } @@ -143,37 +143,37 @@ void CreateTestFormData(FormData* form) { form->user_submitted = true; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "addr1", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 2", "addr2", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City", "city", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State", "state", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Postal Code", "zipcode", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Country", "country", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "", "text", &field); form->fields.push_back(field); } @@ -186,49 +186,49 @@ void CreateTestFormDataBilling(FormData* form) { form->user_submitted = true; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "billingAddr1", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 2", "billingAddr2", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City", "billingCity", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State", "billingState", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Postal Code", "billingZipcode", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Country", "billingCountry", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Expiration Date", "ccmonth", "", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "", "ccyear", "", "text", &field); form->fields.push_back(field); } @@ -309,7 +309,7 @@ TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -347,7 +347,7 @@ TEST_F(AutoFillManagerTest, GetProfileSuggestionsMatchCharacter) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "E", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -381,7 +381,7 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsEmptyValue) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -425,7 +425,7 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsMatchCharacter) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "1", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -463,7 +463,7 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonCCNumber) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -496,11 +496,11 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonCCNumber) { TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) { // |profile| will be owned by the mock PersonalDataManager. AutoFillProfile* profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", - "flatlander@gmail.com", "MCA", - "916 16th St.", "Apt. 6", "Lubbock", - "Texas", "79401", "USA", - "12345678901", ""); + autofill_test::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", + "flatlander@gmail.com", "MCA", + "916 16th St.", "Apt. 6", "Lubbock", + "Texas", "79401", "USA", + "12345678901", ""); autofill_manager_->AddProfile(profile); FormData form; @@ -516,7 +516,7 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -565,7 +565,7 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonHTTPS) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "", "text", &field); EXPECT_FALSE( autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -585,7 +585,7 @@ TEST_F(AutoFillManagerTest, GetCombinedAutoFillAndAutocompleteSuggestions) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -628,7 +628,7 @@ TEST_F(AutoFillManagerTest, GetFieldSuggestionsFormIsAutoFilled) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, true, field)); @@ -664,7 +664,7 @@ TEST_F(AutoFillManagerTest, GetFieldSuggestionsForAutocompleteOnly) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Some Field", "somefield", "", "text", &field); EXPECT_FALSE(autofill_manager_->GetAutoFillSuggestions(kPageID, true, field)); @@ -702,8 +702,8 @@ TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) { // |profile| will be owned by the mock PersonalDataManager. AutoFillProfile* profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Duplicate", "Elvis", "", "", "", - "", "", "", "", "", "", "", "", ""); + autofill_test::SetProfileInfo(profile, "Duplicate", "Elvis", "", "", "", "", + "", "", "", "", "", "", "", ""); autofill_manager_->AddProfile(profile); // The page ID sent to the AutoFillManager from the RenderView, used to send @@ -711,7 +711,7 @@ TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, true, field)); @@ -747,7 +747,7 @@ TEST_F(AutoFillManagerTest, GetBillingSuggestionsAddress1) { const int kPageID = 1; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "billingAddr1", "", "text", &field); EXPECT_TRUE(autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); @@ -794,50 +794,50 @@ TEST_F(AutoFillManagerTest, FillCreditCardForm) { ASSERT_EQ(15U, results.fields.size()); webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "Elvis", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[0])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "Aaron", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "Presley", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "billingAddr1", - "3734 Elvis Presley Blvd.", "text", &field); + "3734 Elvis Presley Blvd.", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 2", "billingAddr2", "Apt. 10", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City", "billingCity", "Memphis", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[5])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State", "billingState", "Tennessee", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[6])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Postal Code", "billingZipcode", "38116", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[7])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Country", "billingCountry", "USA", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "12345678901", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "theking@gmail.com", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "Elvis Presley", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[11])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "1234567890123456", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Expiration Date", "ccmonth", "04", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "", "ccyear", "2012", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); } @@ -845,11 +845,11 @@ TEST_F(AutoFillManagerTest, FillCreditCardForm) { TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) { // |profile| will be owned by the mock PersonalDataManager. AutoFillProfile* profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", - "flatlander@gmail.com", "MCA", - "916 16th St.", "Apt. 6", "Lubbock", - "Texas", "79401", "USA", - "12345678901", ""); + autofill_test::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", + "flatlander@gmail.com", "MCA", + "916 16th St.", "Apt. 6", "Lubbock", + "Texas", "79401", "USA", + "12345678901", ""); profile->set_unique_id(7); autofill_manager_->AddProfile(profile); @@ -877,37 +877,37 @@ TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) { ASSERT_EQ(11U, results.fields.size()); webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "Joe", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[0])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "Ely", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "addr1", "916 16th St.", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 2", "addr2", "Apt. 6", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City", "city", "Lubbock", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[5])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State", "state", "Texas", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[6])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Postal Code", "zipcode", "79401", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[7])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Country", "country", "USA", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "12345678901", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "flatlander@gmail.com", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); } @@ -915,11 +915,11 @@ TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) { TEST_F(AutoFillManagerTest, FillBillFormSemicolon) { // |profile| will be owned by the mock PersonalDataManager. AutoFillProfile* profile = new AutoFillProfile; - autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", - "flatlander@gmail.com", "MCA", - "916 16th St.", "Apt. 6", "Lubbock", - "Texas", "79401", "USA", - "12345678901", ""); + autofill_test::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", + "flatlander@gmail.com", "MCA", + "916 16th St.", "Apt. 6", "Lubbock", + "Texas", "79401", "USA", + "12345678901", ""); profile->set_unique_id(7); autofill_manager_->AddProfile(profile); @@ -947,50 +947,50 @@ TEST_F(AutoFillManagerTest, FillBillFormSemicolon) { ASSERT_EQ(15U, results.fields.size()); webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "Joe", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[0])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "Ely", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1", "billingAddr1", - "3734 Elvis Presley Blvd.", "text", &field); + "3734 Elvis Presley Blvd.", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 2", "billingAddr2", "Apt. 10", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City", "billingCity", "Memphis", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[5])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State", "billingState", "Tennessee", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[6])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Postal Code", "billingZipcode", "38116", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[7])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Country", "billingCountry", "USA", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "12345678901", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "flatlander@gmail.com", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Name on Card", "nameoncard", "Elvis Presley", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[11])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Card Number", "cardnumber", "1234567890123456", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Expiration Date", "ccmonth", "04", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "", "ccyear", "2012", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); } @@ -1006,23 +1006,23 @@ TEST_F(AutoFillManagerTest, FillPhoneNumber) { webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "country code", "country code", "", "text", &field); field.set_size(1); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "area code", "area code", "", "text", &field); field.set_size(3); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "phone", "phone prefix", "1", "text", &field); field.set_size(3); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "-", "phone suffix", "", "text", &field); field.set_size(4); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Extension", "ext", "", "text", &field); field.set_size(3); form.fields.push_back(field); @@ -1075,19 +1075,19 @@ TEST_F(AutoFillManagerTest, FormChangesRemoveField) { form.user_submitted = true; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "", "text", &field); form.fields.push_back(field); @@ -1115,16 +1115,16 @@ TEST_F(AutoFillManagerTest, FormChangesRemoveField) { EXPECT_TRUE(results.user_submitted); ASSERT_EQ(4U, results.fields.size()); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "Elvis", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[0])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "Aaron", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "Presley", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "theking@gmail.com", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); } @@ -1138,17 +1138,17 @@ TEST_F(AutoFillManagerTest, FormChangesAddField) { form.user_submitted = true; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "", "text", &field); // Note: absent phone number. Adding this below. form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "", "text", &field); form.fields.push_back(field); @@ -1159,7 +1159,7 @@ TEST_F(AutoFillManagerTest, FormChangesAddField) { // Now, after the call to |FormsSeen| we add the phone number field before // filling. - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "", "text", &field); form.fields.insert(form.fields.begin() + 3, field); @@ -1178,19 +1178,19 @@ TEST_F(AutoFillManagerTest, FormChangesAddField) { EXPECT_TRUE(results.user_submitted); ASSERT_EQ(5U, results.fields.size()); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First Name", "firstname", "Elvis", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[0])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Middle Name", "middlename", "Aaron", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last Name", "lastname", "Presley", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Phone Number", "phonenumber", "", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email", "email", "theking@gmail.com", "text", &field); EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); } @@ -1204,13 +1204,13 @@ TEST_F(AutoFillManagerTest, HiddenFields) { form.user_submitted = true; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "E-mail", "one", "one", "hidden", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "E-mail", "two", "two", "hidden", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "E-mail", "three", "three", "hidden", &field); form.fields.push_back(field); diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc index 81dadb5..d217355 100644 --- a/chrome/browser/autofill/autofill_profile_unittest.cc +++ b/chrome/browser/autofill/autofill_profile_unittest.cc @@ -7,7 +7,7 @@ #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_profile.h" #include "grit/generated_resources.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,7 +24,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 0/empty: "" AutoFillProfile profile00(string16(), 0); - autofill_unittest::SetProfileInfo(&profile00, "Billing", "", "Mitchell", "", + autofill_test::SetProfileInfo(&profile00, "Billing", "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary00 = profile00.PreviewSummary(); @@ -32,7 +32,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 1: "<address>" AutoFillProfile profile1(string16(), 0); - autofill_unittest::SetProfileInfo(&profile1, "Billing", "", "Mitchell", "", + autofill_test::SetProfileInfo(&profile1, "Billing", "", "Mitchell", "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary1 = profile1.PreviewSummary(); @@ -40,7 +40,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 2: "<lastname>" AutoFillProfile profile2(string16(), 0); - autofill_unittest::SetProfileInfo(&profile2, "Billing", "", "Mitchell", + autofill_test::SetProfileInfo(&profile2, "Billing", "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary2 = profile2.PreviewSummary(); @@ -48,7 +48,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 3: "<lastname>, <address>" AutoFillProfile profile3(string16(), 0); - autofill_unittest::SetProfileInfo(&profile3, "Billing", "", "Mitchell", + autofill_test::SetProfileInfo(&profile3, "Billing", "", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary3 = profile3.PreviewSummary(); @@ -56,23 +56,23 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 4: "<firstname>" AutoFillProfile profile4(string16(), 0); - autofill_unittest::SetProfileInfo(&profile4, "Billing", "Marion", "Mitchell", - "", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", - "US", "12345678910", "01987654321"); + autofill_test::SetProfileInfo(&profile4, "Billing", "Marion", "Mitchell", "", + "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", + "12345678910", "01987654321"); string16 summary4 = profile4.PreviewSummary(); EXPECT_EQ(string16(ASCIIToUTF16("Marion")), summary4); // Case 5: "<firstname>, <address>" AutoFillProfile profile5(string16(), 0); - autofill_unittest::SetProfileInfo(&profile5, "Billing", "Marion", "Mitchell", - "", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", + autofill_test::SetProfileInfo(&profile5, "Billing", "Marion", "Mitchell", "", + "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary5 = profile5.PreviewSummary(); EXPECT_EQ(string16(ASCIIToUTF16("Marion, 123 Zoo St.")), summary5); // Case 6: "<firstname> <lastname>" AutoFillProfile profile6(string16(), 0); - autofill_unittest::SetProfileInfo(&profile6, "Billing", "Marion", "Mitchell", + autofill_test::SetProfileInfo(&profile6, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary6 = profile6.PreviewSummary(); @@ -80,7 +80,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { // Case 7: "<firstname> <lastname>, <address>" AutoFillProfile profile7(string16(), 0); - autofill_unittest::SetProfileInfo(&profile7, "Billing", "Marion", "Mitchell", + autofill_test::SetProfileInfo(&profile7, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); string16 summary7 = profile7.PreviewSummary(); @@ -90,7 +90,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) { TEST(AutoFillProfileTest, AdjustInferredLabels) { std::vector<AutoFillProfile*> profiles; profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[0], "", "John", @@ -106,7 +106,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { "11111111111", "22222222222"); profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[1], "", "Jane", @@ -131,7 +131,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles[1]->Label()); profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[2], "", "John", @@ -162,7 +162,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles.pop_back(); profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[2], "", "John", @@ -191,7 +191,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles[2]->Label()); profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[3], "", "John", @@ -223,7 +223,7 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) { profiles[3]->Label()); profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo( + autofill_test::SetProfileInfo( profiles[4], "", "John", @@ -273,13 +273,12 @@ TEST(AutoFillProfileTest, IsSubsetOf) { // |a| is a subset of |b|. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL); - autofill_unittest::SetProfileInfo(b.get(), "label2", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", "United States Government", - "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, - NULL); + autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL); + autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson", + "declaration_guy@gmail.com", "United States Government", "Monticello", + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_TRUE(a->IsSubsetOf(*b)); // |b| is not a subset of |a|. @@ -291,12 +290,12 @@ TEST(AutoFillProfileTest, IsSubsetOf) { // One field in |b| is different. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL); - autofill_unittest::SetProfileInfo(a.get(), "label2", "Thomas", NULL, - "Adams", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL); + autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL); + autofill_test::SetProfileInfo(a.get(), "label2", "Thomas", NULL, "Adams", + "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL); EXPECT_FALSE(a->IsSubsetOf(*b)); } @@ -308,35 +307,33 @@ TEST(AutoFillProfileTest, IntersectionOfTypesHasEqualValues) { // profiles. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, "12134759123", "19384284720"); - autofill_unittest::SetProfileInfo(b.get(), "label2", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", "United States Government", - "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, - NULL); + autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "12134759123", "19384284720"); + autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson", + "declaration_guy@gmail.com", "United States Government", "Monticello", + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_TRUE(a->IntersectionOfTypesHasEqualValues(*b)); // Intersection of types contains the fields NAME_FIRST, NAME_LAST, // EMAIL_ADDRESS. The value of EMAIL_ADDRESS differs between the two profiles. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Thomas", NULL, - "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, "12134759123", "19384284720"); - autofill_unittest::SetProfileInfo(b.get(), "label2", "Thomas", NULL, - "Jefferson", "declaration_guy@gmail.com", "United States Government", - "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, - NULL); + autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "12134759123", "19384284720"); + autofill_test::SetProfileInfo(b.get(), "label2", "Thomas", NULL, "Jefferson",\ + "declaration_guy@gmail.com", "United States Government", "Monticello", + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); // Intersection of types is empty. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Thomas", NULL, - "Jefferson", "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, - NULL, NULL, "12134759123", "19384284720"); - autofill_unittest::SetProfileInfo(b.get(), "label2", NULL, NULL, NULL, NULL, + autofill_test::SetProfileInfo(a.get(), "label1", "Thomas", NULL, "Jefferson", + "poser@yahoo.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "12134759123", "19384284720"); + autofill_test::SetProfileInfo(b.get(), "label2", NULL, NULL, NULL, NULL, "United States Government", "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); EXPECT_FALSE(a->IntersectionOfTypesHasEqualValues(*b)); @@ -348,21 +345,19 @@ TEST(AutoFillProfileTest, MergeWith) { // Merge |b| into |a|. a.reset(new AutoFillProfile); b.reset(new AutoFillProfile); - autofill_unittest::SetProfileInfo(a.get(), "label1", "Jimmy", NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, "12134759123", "19384284720"); - autofill_unittest::SetProfileInfo(b.get(), "label2", "James", NULL, - "Madison", "constitutionalist@gmail.com", "United States Government", - "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, - NULL); + autofill_test::SetProfileInfo(a.get(), "label1", "Jimmy", NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, "12134759123", "19384284720"); + autofill_test::SetProfileInfo(b.get(), "label2", "James", NULL, "Madison", + "constitutionalist@gmail.com", "United States Government", "Monticello", + NULL, "Charlottesville", "Virginia", "22902", NULL, NULL, NULL); AutoFillProfile expected_b(*b); a->MergeWith(*b); AutoFillProfile expected_a; - autofill_unittest::SetProfileInfo(&expected_a, "label1", "Jimmy", NULL, - "Madison", "constitutionalist@gmail.com", "United States Government", - "Monticello", NULL, "Charlottesville", "Virginia", "22902", NULL, - "12134759123", "19384284720"); + autofill_test::SetProfileInfo(&expected_a, "label1", "Jimmy", NULL, "Madison", + "constitutionalist@gmail.com", "United States Government", "Monticello", + NULL, "Charlottesville", "Virginia", "22902", NULL, "12134759123", + "19384284720"); EXPECT_EQ(expected_a, *a); EXPECT_EQ(expected_b, *b); } diff --git a/chrome/browser/autofill/credit_card_unittest.cc b/chrome/browser/autofill/credit_card_unittest.cc index 1c7f8ba..5a9a732 100644 --- a/chrome/browser/autofill/credit_card_unittest.cc +++ b/chrome/browser/autofill/credit_card_unittest.cc @@ -4,7 +4,7 @@ #include "base/basictypes.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/credit_card.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,7 +23,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 00: Empty credit card with empty strings. CreditCard credit_card00(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card00, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card00, "Corporate", "John Dillinger", "Visa", "", "", "", 1); string16 summary00 = credit_card00.PreviewSummary(); EXPECT_EQ(string16(), summary00); @@ -32,7 +32,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 1: No credit card number. CreditCard credit_card1(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card1, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card1, "Corporate", "John Dillinger", "Visa", "", "01", "2010", 1); string16 summary1 = credit_card1.PreviewSummary(); EXPECT_EQ(string16(), summary1); @@ -41,7 +41,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 2: No month. CreditCard credit_card2(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card2, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card2, "Corporate", "John Dillinger", "Visa", "123456789012", "", "2010", 1); string16 summary2 = credit_card2.PreviewSummary(); EXPECT_EQ(string16(ASCIIToUTF16("************9012")), summary2); @@ -50,7 +50,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 3: No year. CreditCard credit_card3(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card3, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card3, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "", 1); string16 summary3 = credit_card3.PreviewSummary(); EXPECT_EQ(string16(ASCIIToUTF16("************9012")), summary3); @@ -59,7 +59,7 @@ TEST(CreditCardTest, PreviewSummaryAndObfuscatedNumberStrings) { // Case 4: Have everything. CreditCard credit_card4(string16(), 0); - autofill_unittest::SetCreditCardInfo(&credit_card4, "Corporate", + autofill_test::SetCreditCardInfo(&credit_card4, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "2010", 1); string16 summary4 = credit_card4.PreviewSummary(); EXPECT_EQ(string16(ASCIIToUTF16("************9012, Exp: 01/2010")), summary4); diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc index 1709421..5453c5f 100644 --- a/chrome/browser/autofill/personal_data_manager_unittest.cc +++ b/chrome/browser/autofill/personal_data_manager_unittest.cc @@ -7,7 +7,7 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/form_structure.h" #include "chrome/browser/autofill/personal_data_manager.h" @@ -48,15 +48,12 @@ class PersonalDataManagerTest : public testing::Test { } virtual void SetUp() { -#if defined(OS_MACOSX) - Encryptor::UseMockKeychain(true); -#endif - db_thread_.Start(); profile_.reset(new TestingProfile); profile_->CreateWebDataService(false); + autofill_test::DisableSystemServices(profile_.get()); ResetPersonalDataManager(); } @@ -73,11 +70,6 @@ class PersonalDataManagerTest : public testing::Test { personal_data_ = new PersonalDataManager(); personal_data_->Init(profile_.get()); personal_data_->SetObserver(&personal_data_observer_); - - // Disable auxiliary profiles for unit testing. These reach out to system - // services on the Mac. - profile_->GetPrefs()->SetBoolean( - prefs::kAutoFillAuxiliaryProfilesEnabled, false); } AutoFillProfile* MakeProfile() { @@ -100,19 +92,19 @@ class PersonalDataManagerTest : public testing::Test { // TODO(jhawkins): Test SetProfiles w/out a WebDataService in the profile. TEST_F(PersonalDataManagerTest, SetProfiles) { AutoFillProfile profile0(string16(), 0); - autofill_unittest::SetProfileInfo(&profile0, + autofill_test::SetProfileInfo(&profile0, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile profile1(string16(), 0); - autofill_unittest::SetProfileInfo(&profile1, + autofill_test::SetProfileInfo(&profile1, "Home", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); AutoFillProfile profile2(string16(), 0); - autofill_unittest::SetProfileInfo(&profile2, + autofill_test::SetProfileInfo(&profile2, "Work", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -194,16 +186,16 @@ TEST_F(PersonalDataManagerTest, SetProfiles) { // TODO(jhawkins): Test SetCreditCards w/out a WebDataService in the profile. TEST_F(PersonalDataManagerTest, SetCreditCards) { CreditCard creditcard0(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard0, "Corporate", + autofill_test::SetCreditCardInfo(&creditcard0, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "2010", 1); CreditCard creditcard1(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard1, "Personal", + autofill_test::SetCreditCardInfo(&creditcard1, "Personal", "Bonnie Parker", "Mastercard", "098765432109", "12", "2012", 2); CreditCard creditcard2(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard2, "Savings", "Clyde Barrow", - "American Express", "777666888555", "04", "2015", 3); + autofill_test::SetCreditCardInfo(&creditcard2, "Savings", + "Clyde Barrow", "American Express", "777666888555", "04", "2015", 3); // This will verify that the web database has been loaded and the notification // sent out. @@ -278,23 +270,23 @@ TEST_F(PersonalDataManagerTest, SetCreditCards) { TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) { AutoFillProfile profile0(string16(), 0); - autofill_unittest::SetProfileInfo(&profile0, + autofill_test::SetProfileInfo(&profile0, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile profile1(string16(), 0); - autofill_unittest::SetProfileInfo(&profile1, + autofill_test::SetProfileInfo(&profile1, "Home", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); CreditCard creditcard0(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard0, "Corporate", + autofill_test::SetCreditCardInfo(&creditcard0, "Corporate", "John Dillinger", "Visa", "123456789012", "01", "2010", 1); CreditCard creditcard1(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard1, "Personal", + autofill_test::SetCreditCardInfo(&creditcard1, "Personal", "Bonnie Parker", "Mastercard", "098765432109", "12", "2012", 2); // This will verify that the web database has been loaded and the notification @@ -358,7 +350,7 @@ TEST_F(PersonalDataManagerTest, SetProfilesAndCreditCards) { // load. TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { AutoFillProfile profile0(string16(), 0); - autofill_unittest::SetProfileInfo(&profile0, + autofill_test::SetProfileInfo(&profile0, "", "y", "", "", "", "", "", "", "", "", "", "", "", ""); // This will verify that the web database has been loaded and the notification @@ -387,7 +379,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { // Add a new profile. AutoFillProfile profile1(string16(), 0); - autofill_unittest::SetProfileInfo(&profile1, + autofill_test::SetProfileInfo(&profile1, "", "y", "", "", "", "", "", "", "", "", "", "", "", ""); update.clear(); update.push_back(*results2[0]); @@ -405,7 +397,7 @@ TEST_F(PersonalDataManagerTest, PopulateUniqueIDsOnLoad) { TEST_F(PersonalDataManagerTest, SetEmptyProfile) { AutoFillProfile profile0(string16(), 0); - autofill_unittest::SetProfileInfo(&profile0, + autofill_test::SetProfileInfo(&profile0, "", "", "", "", "", "", "", "", "", "", "", "", "", ""); // This will verify that the web database has been loaded and the notification @@ -445,7 +437,7 @@ TEST_F(PersonalDataManagerTest, SetEmptyProfile) { TEST_F(PersonalDataManagerTest, SetEmptyCreditCard) { CreditCard creditcard0(string16(), 0); - autofill_unittest::SetCreditCardInfo(&creditcard0, + autofill_test::SetCreditCardInfo(&creditcard0, "", "", "", "", "", "", 0); // This will verify that the web database has been loaded and the notification @@ -485,13 +477,13 @@ TEST_F(PersonalDataManagerTest, SetEmptyCreditCard) { TEST_F(PersonalDataManagerTest, Refresh) { AutoFillProfile profile0(string16(), 0); - autofill_unittest::SetProfileInfo(&profile0, + autofill_test::SetProfileInfo(&profile0, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile profile1(string16(), 0); - autofill_unittest::SetProfileInfo(&profile1, + autofill_test::SetProfileInfo(&profile1, "Home", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "903 Apple Ct.", NULL, "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -524,7 +516,7 @@ TEST_F(PersonalDataManagerTest, Refresh) { EXPECT_EQ(profile1, *results1.at(1)); scoped_ptr<AutoFillProfile> profile2(MakeProfile()); - autofill_unittest::SetProfileInfo(profile2.get(), + autofill_test::SetProfileInfo(profile2.get(), "Work", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -576,13 +568,13 @@ TEST_F(PersonalDataManagerTest, Refresh) { TEST_F(PersonalDataManagerTest, ImportFormData) { FormData form; webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last name:", "last_name", "Washington", "text", &field); form.fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email:", "email", "theprez@gmail.com", "text", &field); form.fields.push_back(field); FormStructure form_structure(form); @@ -597,7 +589,7 @@ TEST_F(PersonalDataManagerTest, ImportFormData) { MessageLoop::current()->Run(); AutoFillProfile expected(string16(), 1); - autofill_unittest::SetProfileInfo(&expected, NULL, "George", NULL, + autofill_test::SetProfileInfo(&expected, NULL, "George", NULL, "Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); @@ -652,13 +644,13 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { scoped_ptr<FormData> form(new FormData); webkit_glue::FormField field; - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last name:", "last_name", "Washington", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email:", "email", "theprez@gmail.com", "text", &field); form->fields.push_back(field); @@ -676,7 +668,7 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { scoped_ptr<AutoFillProfile> expected( new AutoFillProfile(string16(), 1)); - autofill_unittest::SetProfileInfo(expected.get(), NULL, "George", NULL, + autofill_test::SetProfileInfo(expected.get(), NULL, "George", NULL, "Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); @@ -686,13 +678,13 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { // Now create a completely different profile. form.reset(new FormData); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First name:", "first_name", "John", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last name:", "last_name", "Adams", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Email:", "email", "second@gmail.com", "text", &field); form->fields.push_back(field); @@ -711,14 +703,14 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { ASSERT_EQ(2U, results2.size()); expected.reset(new AutoFillProfile(string16(), 1)); - autofill_unittest::SetProfileInfo(expected.get(), NULL, "George", NULL, + autofill_test::SetProfileInfo(expected.get(), NULL, "George", NULL, "Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expected->set_label(results2[0]->Label()); EXPECT_EQ(*expected, *results2[0]); expected.reset(new AutoFillProfile(string16(), 2)); - autofill_unittest::SetProfileInfo(expected.get(), NULL, "John", NULL, + autofill_test::SetProfileInfo(expected.get(), NULL, "John", NULL, "Adams", "second@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expected->set_label(results2[1]->Label()); @@ -726,22 +718,22 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { // Submit a form with new data for the first profile. form.reset(new FormData); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "First name:", "first_name", "George", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Last name:", "last_name", "Washington", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Address Line 1:", "address", "190 High Street", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "City:", "city", "Philadelphia", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "State:", "state", "Pennsylvania", "text", &field); form->fields.push_back(field); - autofill_unittest::CreateTestFormField( + autofill_test::CreateTestFormField( "Zip:", "zipcode", "19106", "text", &field); form->fields.push_back(field); @@ -760,14 +752,14 @@ TEST_F(PersonalDataManagerTest, AggregateProfileData) { ASSERT_EQ(2U, results3.size()); expected.reset(new AutoFillProfile(string16(), 1)); - autofill_unittest::SetProfileInfo(expected.get(), NULL, "George", NULL, + autofill_test::SetProfileInfo(expected.get(), NULL, "George", NULL, "Washington", "theprez@gmail.com", NULL, "190 High Street", NULL, "Philadelphia", "Pennsylvania", "19106", NULL, NULL, NULL); expected->set_label(results3[0]->Label()); EXPECT_EQ(*expected, *results3[0]); expected.reset(new AutoFillProfile(string16(), 2)); - autofill_unittest::SetProfileInfo(expected.get(), NULL, "John", NULL, + autofill_test::SetProfileInfo(expected.get(), NULL, "John", NULL, "Adams", "second@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); expected->set_label(results3[1]->Label()); diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 0fabebe..de32b0c 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -838,12 +838,16 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, OnQueryFormFieldAutoFill) + IPC_MESSAGE_HANDLER(ViewHostMsg_DidShowAutoFillSuggestions, + OnDidShowAutoFillSuggestions) IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutocompleteEntry, OnRemoveAutocompleteEntry) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowAutoFillDialog, OnShowAutoFillDialog) IPC_MESSAGE_HANDLER(ViewHostMsg_FillAutoFillFormData, OnFillAutoFillFormData) + IPC_MESSAGE_HANDLER(ViewHostMsg_DidFillAutoFillFormData, + OnDidFillAutoFillFormData) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification, OnShowDesktopNotification) IPC_MESSAGE_HANDLER(ViewHostMsg_CancelDesktopNotification, @@ -1692,6 +1696,13 @@ void RenderViewHost::OnQueryFormFieldAutoFill( } } +void RenderViewHost::OnDidShowAutoFillSuggestions() { + NotificationService::current()->Notify( + NotificationType::AUTOFILL_DID_SHOW_SUGGESTIONS, + Source<RenderViewHost>(this), + NotificationService::NoDetails()); +} + void RenderViewHost::OnRemoveAutocompleteEntry(const string16& field_name, const string16& value) { RenderViewHostDelegate::Autocomplete* autocomplete_delegate = @@ -1728,6 +1739,13 @@ void RenderViewHost::OnFillAutoFillFormData(int query_id, autofill_delegate->FillAutoFillFormData(query_id, form, unique_id); } +void RenderViewHost::OnDidFillAutoFillFormData() { + NotificationService::current()->Notify( + NotificationType::AUTOFILL_DID_FILL_FORM_DATA, + Source<RenderViewHost>(this), + NotificationService::NoDetails()); +} + void RenderViewHost::AutoFillSuggestionsReturned( int query_id, const std::vector<string16>& names, diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index dcb658d..e5f09ff 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -645,12 +645,14 @@ class RenderViewHost : public RenderWidgetHost { void OnQueryFormFieldAutoFill(int request_id, bool form_autofilled, const webkit_glue::FormField& field); + void OnDidShowAutoFillSuggestions(); void OnRemoveAutocompleteEntry(const string16& field_name, const string16& value); void OnShowAutoFillDialog(); void OnFillAutoFillFormData(int query_id, const webkit_glue::FormData& form, int unique_id); + void OnDidFillAutoFillFormData(); void OnShowDesktopNotification( const ViewHostMsg_ShowNotification_Params& params); diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 1d5d7d4..5cf8665 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -17,7 +17,7 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/waitable_event.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/engine/model_changing_syncer_command.h" @@ -530,7 +530,7 @@ TEST_F(ProfileSyncServiceAutofillTest, HasMixedNativeEmptySync) { std::vector<AutoFillProfile> expected_profiles; // Owned by GetAutoFillProfiles caller. AutoFillProfile* profile0 = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(profile0, + autofill_test::SetProfileInfo(profile0, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -585,12 +585,12 @@ TEST_F(ProfileSyncServiceAutofillTest, HasDuplicateProfileLabelsEmptySync) { std::vector<AutoFillProfile> expected_profiles; std::vector<AutoFillProfile*> profiles; AutoFillProfile* profile0 = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(profile0, + autofill_test::SetProfileInfo(profile0, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile* profile1 = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(profile1, + autofill_test::SetProfileInfo(profile1, "Billing", "Same", "Label", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -647,13 +647,13 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncNoMerge) { AutofillEntry native_entry(MakeAutofillEntry("native", "entry", 1)); AutofillEntry sync_entry(MakeAutofillEntry("sync", "entry", 2)); AutoFillProfile sync_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&sync_profile, + autofill_test::SetProfileInfo(&sync_profile, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile* native_profile = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(native_profile, + autofill_test::SetProfileInfo(native_profile, "Work", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -736,13 +736,13 @@ TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) { TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) { AutoFillProfile sync_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&sync_profile, + autofill_test::SetProfileInfo(&sync_profile, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); AutoFillProfile* native_profile = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(native_profile, + autofill_test::SetProfileInfo(native_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -812,7 +812,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { ASSERT_TRUE(task.success()); AutoFillProfile added_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&added_profile, + autofill_test::SetProfileInfo(&added_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -834,7 +834,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfileConflict) { AutoFillProfile sync_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&sync_profile, + autofill_test::SetProfileInfo(&sync_profile, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -855,7 +855,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfileConflict) { ASSERT_TRUE(task.success()); AutoFillProfile added_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&added_profile, + autofill_test::SetProfileInfo(&added_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -924,7 +924,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfile) { AutoFillProfile* native_profile = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(native_profile, + autofill_test::SetProfileInfo(native_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -939,7 +939,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfile) { ASSERT_TRUE(task.success()); AutoFillProfile update_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&update_profile, + autofill_test::SetProfileInfo(&update_profile, "Billing", "Changin'", "Mah", "Namez", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -962,7 +962,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfile) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfileRelabel) { AutoFillProfile* native_profile = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(native_profile, + autofill_test::SetProfileInfo(native_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -977,7 +977,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfileRelabel) { ASSERT_TRUE(task.success()); AutoFillProfile update_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&update_profile, + autofill_test::SetProfileInfo(&update_profile, "TRYIN 2 FOOL U", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); @@ -1003,11 +1003,11 @@ TEST_F(ProfileSyncServiceAutofillTest, std::vector<AutoFillProfile*> native_profiles; native_profiles.push_back(new AutoFillProfile(string16(), 0)); native_profiles.push_back(new AutoFillProfile(string16(), 0)); - autofill_unittest::SetProfileInfo(native_profiles[0], + autofill_test::SetProfileInfo(native_profiles[0], "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); - autofill_unittest::SetProfileInfo(native_profiles[1], + autofill_test::SetProfileInfo(native_profiles[1], "ExistingLabel", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); @@ -1092,12 +1092,12 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { AutoFillProfile sync_profile(string16(), 0); - autofill_unittest::SetProfileInfo(&sync_profile, + autofill_test::SetProfileInfo(&sync_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); AutoFillProfile* native_profile = new AutoFillProfile(string16(), 0); - autofill_unittest::SetProfileInfo(native_profile, + autofill_test::SetProfileInfo(native_profile, "Billing", "Josephine", "Alicia", "Saenz", "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL", "32801", "US", "19482937549", "13502849239"); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 4632e95..4b0e32e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -293,6 +293,8 @@ 'defines': [ 'ALLOW_IN_PROC_BROWSER_TEST' ], 'sources': [ 'browser/autocomplete/autocomplete_edit_view_browsertest.cc', + 'browser/autofill/autofill_common_test.cc', + 'browser/autofill/autofill_browsertest.cc', 'browser/browser_focus_uitest.cc', 'browser/browser_keyevents_browsertest.cc', 'browser/collected_cookies_uitest.cc', @@ -980,8 +982,8 @@ 'browser/autofill/address_field_unittest.cc', 'browser/autofill/autofill_address_model_mac_unittest.mm', 'browser/autofill/autofill_address_sheet_controller_mac_unittest.mm', - 'browser/autofill/autofill_common_unittest.cc', - 'browser/autofill/autofill_common_unittest.h', + 'browser/autofill/autofill_common_test.cc', + 'browser/autofill/autofill_common_test.h', 'browser/autofill/autofill_credit_card_model_mac_unittest.mm', 'browser/autofill/autofill_credit_card_sheet_controller_mac_unittest.mm', 'browser/autofill/autofill_dialog_controller_mac_unittest.mm', @@ -2601,8 +2603,8 @@ 'app/chrome_dll.rc', 'app/chrome_dll_resource.h', 'app/chrome_dll_version.rc.version', - 'browser/autofill/autofill_common_unittest.cc', - 'browser/autofill/autofill_common_unittest.h', + 'browser/autofill/autofill_common_test.cc', + 'browser/autofill/autofill_common_test.h', 'test/bookmark_load_observer.h', 'test/in_process_browser_test.cc', 'test/in_process_browser_test.h', diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index 12fe7cc..bd3ebcd 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -1099,6 +1099,16 @@ class NotificationType { // GoogleServiceAuthError object. GOOGLE_SIGNIN_FAILED, + // AutoFill Notifications -------------------------------------------------- + + // Sent when a popup with AutoFill suggestions is shown in the renderer. + // The source is the corresponding RenderViewHost. There are not details. + AUTOFILL_DID_SHOW_SUGGESTIONS, + + // Sent when a form is previewed or filled with AutoFill suggestions. + // The source is the corresponding RenderViewHost. There are not details. + AUTOFILL_DID_FILL_FORM_DATA, + // Misc -------------------------------------------------------------------- diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index d4b20f2..349c423 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1196,7 +1196,7 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStartLoading) // Sent when the renderer is done loading a page. This corresponds to WebKit's - // noption of the throbber stopping. + // notion of the throbber stopping. IPC_MESSAGE_ROUTED0(ViewHostMsg_DidStopLoading) // Sent when the document element is available for the toplevel frame. This @@ -2023,6 +2023,9 @@ IPC_BEGIN_MESSAGES(ViewHost) bool /* form_autofilled */, webkit_glue::FormField /* the form field */) + // Sent when the popup with AutoFill suggestions for a form is shown. + IPC_MESSAGE_ROUTED0(ViewHostMsg_DidShowAutoFillSuggestions) + // Instructs the browser to fill in the values for a form using AutoFill // profile data. IPC_MESSAGE_ROUTED3(ViewHostMsg_FillAutoFillFormData, @@ -2030,6 +2033,9 @@ IPC_BEGIN_MESSAGES(ViewHost) webkit_glue::FormData /* the form */, int /* profile unique ID */) + // Sent when a form is previewed or filled with AutoFill suggestions. + IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFillAutoFillFormData) + // Instructs the browser to remove the specified Autocomplete entry from the // database. IPC_MESSAGE_ROUTED2(ViewHostMsg_RemoveAutocompleteEntry, diff --git a/chrome/renderer/autofill_helper.cc b/chrome/renderer/autofill_helper.cc index 5ea469b..8221287 100644 --- a/chrome/renderer/autofill_helper.cc +++ b/chrome/renderer/autofill_helper.cc @@ -128,6 +128,9 @@ void AutoFillHelper::SuggestionsReceived(int query_id, web_view->applyAutoFillSuggestions( autofill_query_node_, v, l, i, ids, separator_index); } + + render_view_->Send(new ViewHostMsg_DidShowAutoFillSuggestions( + render_view_->routing_id())); } void AutoFillHelper::FormDataFilled(int query_id, @@ -146,6 +149,8 @@ void AutoFillHelper::FormDataFilled(int query_id, NOTREACHED(); } autofill_action_ = AUTOFILL_NONE; + render_view_->Send(new ViewHostMsg_DidFillAutoFillFormData( + render_view_->routing_id())); } void AutoFillHelper::DidSelectAutoFillSuggestion(const WebNode& node, diff --git a/chrome/test/live_sync/live_autofill_sync_test.h b/chrome/test/live_sync/live_autofill_sync_test.h index 9eff1f5..48c1db2 100644 --- a/chrome/test/live_sync/live_autofill_sync_test.h +++ b/chrome/test/live_sync/live_autofill_sync_test.h @@ -11,7 +11,7 @@ #include <vector> #include "base/command_line.h" -#include "chrome/browser/autofill/autofill_common_unittest.h" +#include "chrome/browser/autofill/autofill_common_test.h" #include "chrome/browser/autofill/autofill_profile.h" #include "chrome/browser/autofill/autofill_type.h" #include "chrome/browser/autofill/field_types.h" @@ -106,24 +106,24 @@ enum ProfileType { void FillProfile(ProfileType type, AutoFillProfile* profile) { switch (type) { case PROFILE_MARION: - autofill_unittest::SetProfileInfo(profile, + autofill_test::SetProfileInfo(profile, "Billing", "Marion", "Mitchell", "Morrison", "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "12345678910", "01987654321"); break; case PROFILE_HOMER: - autofill_unittest::SetProfileInfo(profile, + autofill_test::SetProfileInfo(profile, "Shipping", "Homer", "J.", "Simpson", "homer@snpp.com", "SNPP", "1 Main St", "PO Box 1", "Springfield", "MA", "94101", "US", "14155551212", "14155551313"); break; case PROFILE_FRASIER: - autofill_unittest::SetProfileInfo(profile, + autofill_test::SetProfileInfo(profile, "Business", "Frasier", "Winslow", "Crane", "", "randomness", "", "Apt. 4", "Seattle", "WA", "99121", "US", "0000000000", "ABCDEFGHIJK"); case PROFILE_NULL: - autofill_unittest::SetProfileInfo(profile, + autofill_test::SetProfileInfo(profile, "", "key", "", "", "", "", "", "", "", "", "", "", "", ""); break; } |