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

Unified Diff: components/autofill/core/browser/personal_data_manager_unittest.cc

Issue 2061303002: [Autofill] Log the number of profiles considered/removed during dedupe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/personal_data_manager_unittest.cc
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc
index deee27ce5c10984b808879aa3a93d70ac65698e8..ce83aaad5593036e91100ae016809242cc44d8cf 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -19,6 +19,7 @@
#include "base/metrics/field_trial.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
+#include "base/test/histogram_tester.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -4440,6 +4441,7 @@ TEST_F(PersonalDataManagerTest, DedupeOnInsert) {
"homer.simpson@abc.com", "", "742. Evergreen Terrace",
"", "Springfield", "IL", "91601", "US", "12345678910");
+ base::HistogramTester histogram_tester;
// Save the imported profile (use it).
personal_data_->SaveImportedProfile(imported_profile);
@@ -4452,6 +4454,12 @@ TEST_F(PersonalDataManagerTest, DedupeOnInsert) {
// The imported profile and saved profiles 1 and 2 should be merged together.
// Therefore there should only be 3 saved profiles.
ASSERT_EQ(3U, profiles.size());
+ // 4 profiles were considered for dedupe.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesConsideredForDedupe", 4, 1);
+ // 1 profile was removed.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesRemovedDuringDedupe", 1, 1);
// Sort the profiles by frecency to have a deterministic order.
base::Time comparison_time = base::Time::Now();
@@ -4529,9 +4537,16 @@ TEST_F(PersonalDataManagerTest,
existing_profiles.push_back(&profile4);
existing_profiles.push_back(&profile5);
+ base::HistogramTester histogram_tester;
std::vector<std::string> guids_to_delete;
personal_data_->FindAndMergeDuplicateProfiles(existing_profiles, &profile1,
&guids_to_delete);
+ // 5 profiles were considered for dedupe.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesConsideredForDedupe", 5, 1);
+ // 2 profiles were removed.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesRemovedDuringDedupe", 2, 1);
// Profile1 should be deleted because it was sent as the profile to merge and
// thus was merged into profile3 and then into profile5.
@@ -4587,6 +4602,7 @@ TEST_F(PersonalDataManagerTest,
"homer.simpson@abc.com", "", "742. Evergreen Terrace",
"", "Springfield", "IL", "91601", "US", "");
+ base::HistogramTester histogram_tester;
personal_data_->SaveImportedProfile(imported_profile);
EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
@@ -4598,6 +4614,12 @@ TEST_F(PersonalDataManagerTest,
// The imported profile and saved profiles 1 and 2 should be merged together.
// Therefore there should only be 1 saved profile.
ASSERT_EQ(1U, profiles.size());
+ // 2 profiles were considered for dedupe.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesConsideredForDedupe", 2, 1);
+ // 1 profile was removed.
+ histogram_tester.ExpectUniqueSample(
+ "Autofill.NumberOfProfilesRemovedDuringDedupe", 1, 1);
// Since profiles with higher frecency scores are merged into profiles with
// lower frecency scores, the result of the merge should be contained in
« no previous file with comments | « components/autofill/core/browser/personal_data_manager.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698