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

Unified Diff: components/ntp_tiles/metrics_unittest.cc

Issue 2671983002: ntp_tiles: Add UMA histograms to correlate icon type to position (Closed)
Patch Set: Fixes. 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
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..54d2b5fed53518aa113559274ed72c304d3968f9 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.SuggestionsImpressionIcon.Real"),
+ 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.SuggestionsImpressionIcon.Color"),
+ 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.SuggestionsImpressionIcon.Gray"),
+ 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.SuggestionsImpressionIcon.Real"),
+ IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpressionIcon.Color"),
+ IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples(
+ "NewTabPage.SuggestionsImpressionIcon.Gray"),
+ 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.MostVisitedClickIcon.Real"),
+ ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisitedClickIcon.Color"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisitedClickIcon.Gray"),
+ IsEmpty());
+}
+
+TEST(RecordTileClickTest, ShouldIgnoreThumbnails) {
+ base::HistogramTester histogram_tester;
+ RecordTileClick(3, NTPTileSource::TOP_SITES, THUMBNAIL);
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisitedClickIcon.Real"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisitedClickIcon.Color"),
+ IsEmpty());
+ EXPECT_THAT(
+ histogram_tester.GetAllSamples("NewTabPage.MostVisitedClickIcon.Gray"),
+ IsEmpty());
}
TEST(RecordPageImpressionTest, ShouldRecordRappor) {

Powered by Google App Engine
This is Rietveld 408576698