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

Unified Diff: components/ntp_tiles/metrics_unittest.cc

Issue 2671983002: ntp_tiles: Add UMA histograms to correlate icon type to position (Closed)
Patch Set: Adopted histogram suffixes. Created 3 years, 10 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/ntp_tiles/metrics.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/ntp_tiles/metrics_unittest.cc
diff --git a/components/ntp_tiles/metrics_unittest.cc b/components/ntp_tiles/metrics_unittest.cc
index 53438777ee560b72fdfd6210b9b186f482013f4b..acb8c5a0ef29409958f283c2b3e394dc67fc92b8 100644
--- a/components/ntp_tiles/metrics_unittest.cc
+++ b/components/ntp_tiles/metrics_unittest.cc
@@ -78,6 +78,20 @@ TEST(RecordPageImpressionTest, ShouldRecordUmaForIcons) {
ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.IconsGray"),
ElementsAre(base::Bucket(/*min=*/1, /*count=*/1)));
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsReal"),
+ ElementsAre(base::Bucket(/*min=*/0, /*count=*/1),
+ base::Bucket(/*min=*/1, /*count=*/1),
+ base::Bucket(/*min=*/2, /*count=*/1),
+ base::Bucket(/*min=*/5, /*count=*/1)));
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsColor"),
+ ElementsAre(base::Bucket(/*min=*/3, /*count=*/1),
+ base::Bucket(/*min=*/4, /*count=*/1),
+ base::Bucket(/*min=*/7, /*count=*/1)));
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsGray"),
+ ElementsAre(base::Bucket(/*min=*/6, /*count=*/1)));
}
TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) {
@@ -115,6 +129,49 @@ TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) {
IsEmpty());
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.IconsGray"),
IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsReal"),
+ IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsColor"),
+ IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpression.IconsGray"),
+ IsEmpty());
+}
+
+TEST(RecordTileClickTest, ShouldRecordUma) {
+ base::HistogramTester histogram_tester;
+ RecordTileClick(3, NTPTileSource::TOP_SITES, ICON_REAL);
+ EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
+ ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+ EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.server"),
+ IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.popular"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"),
+ ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsColor"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"),
+ IsEmpty());
+}
+
+TEST(RecordTileClickTest, ShouldIgnoreThumbnails) {
+ base::HistogramTester histogram_tester;
+ RecordTileClick(3, NTPTileSource::TOP_SITES, THUMBNAIL);
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsColor"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"),
+ IsEmpty());
}
TEST(RecordPageImpressionTest, ShouldRecordRappor) {
« no previous file with comments | « components/ntp_tiles/metrics.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698