| Index: chrome/browser/autofill/autofill_manager_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/autofill/autofill_manager_unittest.cc (revision 56214)
|
| +++ chrome/browser/autofill/autofill_manager_unittest.cc (working copy)
|
| @@ -44,6 +44,7 @@
|
|
|
| virtual void InitializeIfNeeded() {}
|
| virtual void SaveImportedFormData() {}
|
| + virtual bool IsDataLoaded() const { return true; }
|
|
|
| AutoFillProfile* GetLabeledProfile(const char* label) {
|
| for (std::vector<AutoFillProfile *>::iterator it = web_profiles_.begin();
|
| @@ -108,10 +109,14 @@
|
|
|
| class TestAutoFillManager : public AutoFillManager {
|
| public:
|
| - explicit TestAutoFillManager(TabContents* tab_contents)
|
| + TestAutoFillManager(TabContents* tab_contents,
|
| + TestPersonalDataManager* personal_manager)
|
| : AutoFillManager(tab_contents, NULL) {
|
| - test_personal_data_ = new TestPersonalDataManager();
|
| - set_personal_data_manager(test_personal_data_.get());
|
| + test_personal_data_ = personal_manager;
|
| + set_personal_data_manager(personal_manager);
|
| + // Download manager requests are disabled for purposes of this unit-test.
|
| + // These request are tested in autofill_download_unittest.cc.
|
| + set_disable_download_manager_requests(true);
|
| }
|
|
|
| virtual bool IsAutoFillEnabled() const { return true; }
|
| @@ -125,7 +130,7 @@
|
| }
|
|
|
| private:
|
| - scoped_refptr<TestPersonalDataManager> test_personal_data_;
|
| + TestPersonalDataManager* test_personal_data_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TestAutoFillManager);
|
| };
|
| @@ -231,10 +236,18 @@
|
| class AutoFillManagerTest : public RenderViewHostTestHarness {
|
| public:
|
| AutoFillManagerTest() {}
|
| + virtual ~AutoFillManagerTest() {
|
| + // Order of destruction is important as AutoFillManager relies on
|
| + // PersonalDataManager to be around when it gets destroyed.
|
| + autofill_manager_.reset(NULL);
|
| + test_personal_data_ = NULL;
|
| + }
|
|
|
| virtual void SetUp() {
|
| RenderViewHostTestHarness::SetUp();
|
| - autofill_manager_.reset(new TestAutoFillManager(contents()));
|
| + test_personal_data_ = new TestPersonalDataManager();
|
| + autofill_manager_.reset(new TestAutoFillManager(contents(),
|
| + test_personal_data_.get()));
|
| }
|
|
|
| Profile* profile() { return contents()->profile(); }
|
| @@ -276,20 +289,13 @@
|
|
|
| protected:
|
| scoped_ptr<TestAutoFillManager> autofill_manager_;
|
| + scoped_refptr<TestPersonalDataManager> test_personal_data_;
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest);
|
| };
|
|
|
| -// TODO(georgey): All of these tests crash in official
|
| -// builds. http://crbug.com/50537
|
| -#if defined(GOOGLE_CHROME_BUILD)
|
| -#define SKIP_BRANDED(test) DISABLED_##test
|
| -#else
|
| -#define SKIP_BRANDED(test) test
|
| -#endif
|
| -
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsEmptyValue)) {
|
| +TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -327,7 +333,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsMatchCharacter)) {
|
| +TEST_F(AutoFillManagerTest, GetProfileSuggestionsMatchCharacter) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -361,7 +367,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsEmptyValue)) {
|
| +TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsEmptyValue) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
|
|
| @@ -405,8 +411,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest,
|
| - SKIP_BRANDED(GetCreditCardSuggestionsMatchCharacter)) {
|
| +TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsMatchCharacter) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
|
|
| @@ -444,7 +449,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonCCNumber)) {
|
| +TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonCCNumber) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
|
|
| @@ -488,7 +493,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsSemicolon)) {
|
| +TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) {
|
| // |profile| will be owned by the mock PersonalDataManager.
|
| AutoFillProfile* profile = new AutoFillProfile;
|
| autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely",
|
| @@ -545,7 +550,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("Joe Ely; *8765"), labels[7]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonHTTPS)) {
|
| +TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonHTTPS) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
| form.origin = GURL("http://myform.com/form.html");
|
| @@ -566,8 +571,7 @@
|
| autofill_manager_->GetAutoFillSuggestions(kPageID, false, field));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest,
|
| - SKIP_BRANDED(GetCombinedAutoFillAndAutocompleteSuggestions)) {
|
| +TEST_F(AutoFillManagerTest, GetCombinedAutoFillAndAutocompleteSuggestions) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -610,7 +614,7 @@
|
| EXPECT_EQ(string16(), labels[3]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetFieldSuggestionsFormIsAutoFilled)) {
|
| +TEST_F(AutoFillManagerTest, GetFieldSuggestionsFormIsAutoFilled) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -646,8 +650,7 @@
|
| EXPECT_EQ(string16(), labels[1]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest,
|
| - SKIP_BRANDED(GetFieldSuggestionsForAutocompleteOnly)) {
|
| +TEST_F(AutoFillManagerTest, GetFieldSuggestionsForAutocompleteOnly) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -683,8 +686,7 @@
|
| ASSERT_EQ(0U, labels.size());
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest,
|
| - SKIP_BRANDED(GetFieldSuggestionsWithDuplicateValues)) {
|
| +TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) {
|
| FormData form;
|
| CreateTestFormData(&form);
|
|
|
| @@ -726,7 +728,7 @@
|
| EXPECT_EQ(string16(), labels[1]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetBillingSuggestionsAddress1)) {
|
| +TEST_F(AutoFillManagerTest, GetBillingSuggestionsAddress1) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
|
|
| @@ -762,7 +764,7 @@
|
| EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[1]);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillCreditCardForm)) {
|
| +TEST_F(AutoFillManagerTest, FillCreditCardForm) {
|
| FormData form;
|
| CreateTestFormDataBilling(&form);
|
|
|
| @@ -836,7 +838,7 @@
|
| EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14]));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillNonBillingFormSemicolon)) {
|
| +TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) {
|
| // |profile| will be owned by the mock PersonalDataManager.
|
| AutoFillProfile* profile = new AutoFillProfile;
|
| autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely",
|
| @@ -907,7 +909,7 @@
|
| EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10]));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillBillFormSemicolon)) {
|
| +TEST_F(AutoFillManagerTest, FillBillFormSemicolon) {
|
| // |profile| will be owned by the mock PersonalDataManager.
|
| AutoFillProfile* profile = new AutoFillProfile;
|
| autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely",
|
| @@ -991,7 +993,7 @@
|
| EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14]));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillPhoneNumber)) {
|
| +TEST_F(AutoFillManagerTest, FillPhoneNumber) {
|
| FormData form;
|
|
|
| form.name = ASCIIToUTF16("MyPhoneForm");
|
| @@ -1064,7 +1066,7 @@
|
| work_profile->SetInfo(phone_type, saved_phone);
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesRemoveField)) {
|
| +TEST_F(AutoFillManagerTest, FormChangesRemoveField) {
|
| FormData form;
|
| form.name = ASCIIToUTF16("MyForm");
|
| form.method = ASCIIToUTF16("POST");
|
| @@ -1129,7 +1131,7 @@
|
| EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3]));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesAddField)) {
|
| +TEST_F(AutoFillManagerTest, FormChangesAddField) {
|
| FormData form;
|
| form.name = ASCIIToUTF16("MyForm");
|
| form.method = ASCIIToUTF16("POST");
|
| @@ -1197,7 +1199,7 @@
|
| EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4]));
|
| }
|
|
|
| -TEST_F(AutoFillManagerTest, SKIP_BRANDED(HiddenFields)) {
|
| +TEST_F(AutoFillManagerTest, HiddenFields) {
|
| FormData form;
|
| form.name = ASCIIToUTF16("MyForm");
|
| form.method = ASCIIToUTF16("POST");
|
|
|