| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 TestPersonalDataManager() | 38 TestPersonalDataManager() |
| 39 : PersonalDataManager("en-US"), autofill_enabled_(true) { | 39 : PersonalDataManager("en-US"), autofill_enabled_(true) { |
| 40 CreateTestAutofillProfiles(&web_profiles_); | 40 CreateTestAutofillProfiles(&web_profiles_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 using PersonalDataManager::set_database; | 43 using PersonalDataManager::set_database; |
| 44 using PersonalDataManager::SetPrefService; | 44 using PersonalDataManager::SetPrefService; |
| 45 | 45 |
| 46 // Overridden to avoid a trip to the database. This should be a no-op except | 46 // Overridden to avoid a trip to the database. This should be a no-op except |
| 47 // for the side-effect of logging the profile count. | 47 // for the side-effect of logging the profile count. |
| 48 virtual void LoadProfiles() override { | 48 void LoadProfiles() override { |
| 49 std::vector<AutofillProfile*> profiles; | 49 std::vector<AutofillProfile*> profiles; |
| 50 web_profiles_.release(&profiles); | 50 web_profiles_.release(&profiles); |
| 51 WDResult<std::vector<AutofillProfile*> > result(AUTOFILL_PROFILES_RESULT, | 51 WDResult<std::vector<AutofillProfile*> > result(AUTOFILL_PROFILES_RESULT, |
| 52 profiles); | 52 profiles); |
| 53 pending_profiles_query_ = 123; | 53 pending_profiles_query_ = 123; |
| 54 OnWebDataServiceRequestDone(pending_profiles_query_, &result); | 54 OnWebDataServiceRequestDone(pending_profiles_query_, &result); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Overridden to avoid a trip to the database. | 57 // Overridden to avoid a trip to the database. |
| 58 virtual void LoadCreditCards() override {} | 58 void LoadCreditCards() override {} |
| 59 | 59 |
| 60 void set_autofill_enabled(bool autofill_enabled) { | 60 void set_autofill_enabled(bool autofill_enabled) { |
| 61 autofill_enabled_ = autofill_enabled; | 61 autofill_enabled_ = autofill_enabled; |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual bool IsAutofillEnabled() const override { | 64 bool IsAutofillEnabled() const override { return autofill_enabled_; } |
| 65 return autofill_enabled_; | |
| 66 } | |
| 67 | 65 |
| 68 private: | 66 private: |
| 69 void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { | 67 void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { |
| 70 AutofillProfile* profile = new AutofillProfile; | 68 AutofillProfile* profile = new AutofillProfile; |
| 71 test::SetProfileInfo(profile, "Elvis", "Aaron", | 69 test::SetProfileInfo(profile, "Elvis", "Aaron", |
| 72 "Presley", "theking@gmail.com", "RCA", | 70 "Presley", "theking@gmail.com", "RCA", |
| 73 "3734 Elvis Presley Blvd.", "Apt. 10", | 71 "3734 Elvis Presley Blvd.", "Apt. 10", |
| 74 "Memphis", "Tennessee", "38116", "US", | 72 "Memphis", "Tennessee", "38116", "US", |
| 75 "12345678901"); | 73 "12345678901"); |
| 76 profile->set_guid("00000000-0000-0000-0000-000000000001"); | 74 profile->set_guid("00000000-0000-0000-0000-000000000001"); |
| (...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 histogram_tester.ExpectTotalCount( | 1093 histogram_tester.ExpectTotalCount( |
| 1096 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); | 1094 "Autofill.FillDuration.FromInteraction.WithAutofill", 0); |
| 1097 histogram_tester.ExpectTotalCount( | 1095 histogram_tester.ExpectTotalCount( |
| 1098 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); | 1096 "Autofill.FillDuration.FromInteraction.WithoutAutofill", 0); |
| 1099 | 1097 |
| 1100 autofill_manager_->Reset(); | 1098 autofill_manager_->Reset(); |
| 1101 } | 1099 } |
| 1102 } | 1100 } |
| 1103 | 1101 |
| 1104 } // namespace autofill | 1102 } // namespace autofill |
| OLD | NEW |