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

Unified Diff: components/ntp_tiles/metrics_unittest.cc

Issue 2796643002: NTP: Record TileType metrics also on desktop (Closed)
Patch Set: Tests! Created 3 years, 9 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 f5d5126ec667961af2acc8bf67d2f9aab7e5c0c7..09d860baff877ac41b73919e065ada859cd8bc44 100644
--- a/components/ntp_tiles/metrics_unittest.cc
+++ b/components/ntp_tiles/metrics_unittest.cc
@@ -90,7 +90,7 @@ TEST(RecordPageImpressionTest, ShouldRecordUmaForIcons) {
TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) {
base::HistogramTester histogram_tester;
- RecordPageImpression({{TileSource::TOP_SITES, THUMBNAIL, GURL()},
+ RecordPageImpression({{TileSource::TOP_SITES, THUMBNAIL_FAILED, GURL()},
{TileSource::SUGGESTIONS_SERVICE, THUMBNAIL, GURL()},
{TileSource::POPULAR, THUMBNAIL, GURL()}},
/*rappor_service=*/nullptr);
@@ -110,13 +110,15 @@ TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) {
EXPECT_THAT(histogram_tester.GetAllSamples(
"NewTabPage.SuggestionsImpression.popular"),
ElementsAre(base::Bucket(/*min=*/2, /*count=*/1)));
- EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType"), IsEmpty());
+ EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType"),
+ ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/2),
+ base::Bucket(/*min=*/THUMBNAIL_FAILED, /*count=*/1)));
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.server"),
- IsEmpty());
+ ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/1)));
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.client"),
- IsEmpty());
+ ElementsAre(base::Bucket(/*min=*/THUMBNAIL_FAILED, /*count=*/1)));
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.popular"),
- IsEmpty());
+ ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/1)));
EXPECT_THAT(histogram_tester.GetAllSamples(
"NewTabPage.SuggestionsImpression.IconsReal"),
IsEmpty());
@@ -169,10 +171,10 @@ TEST(RecordPageImpressionTest, ShouldRecordRappor) {
{{TileSource::TOP_SITES, ICON_REAL, GURL("http://www.site1.com/")},
{TileSource::TOP_SITES, ICON_COLOR, GURL("http://www.site2.com/")},
{TileSource::TOP_SITES, ICON_DEFAULT, GURL("http://www.site3.com/")},
- {TileSource::TOP_SITES, THUMBNAIL, GURL("http://www.site4.com/")}},
+ {TileSource::TOP_SITES, UNKNOWN_TILE_TYPE, GURL("http://www.s4.com/")}},
sfiera 2017/04/06 08:53:28 Can this be its own test, instead of hiding it in
Marc Treib 2017/04/06 09:16:44 Sure, done. I've also updated/expanded the tests a
&rappor_service);
- // Thumbnail shouldn't get reported.
+ // Unknown tile type shouldn't get reported.
EXPECT_EQ(3, rappor_service.GetReportsCount());
{

Powered by Google App Engine
This is Rietveld 408576698