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

Unified Diff: chrome/browser/push_messaging/push_messaging_browsertest.cc

Issue 2281673002: Full hookup of BudgetManager interfaces to BudgetDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manager
Patch Set: Fixed hang and cleaned up browsertests Created 4 years, 3 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: chrome/browser/push_messaging/push_messaging_browsertest.cc
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index 4f2482c9cb58017392bb5dbe4714e84a15d6f07a..0afb5a76a04ff80511e2f258c32f37e6d93b2a43 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -848,30 +848,25 @@ IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
EXPECT_NE(kPushMessagingForcedNotificationTag, first_notification.tag());
}
- // Check that the UMA has been recorded correctly.
- // There should be a total of 7 budget samples, spread across 3 buckets. The
- // first four notifications (before any budget is consumed) have budget of 4,
- // which is the starting SES. The next one has 2 (one hidden notification) and
- // the final two have 0 (two hidden notifications.
+ // The BackgroundBudget UMA is recorded when budget is added to the origin.
+ // This happens only once per hour, so there should be a single entry for the
+ // budget.
std::vector<base::Bucket> buckets =
GetHistogramTester()->GetAllSamples("PushMessaging.BackgroundBudget");
- ASSERT_EQ(3.0, buckets.size());
- // First bucket is for 0 budget, which has 2 samples.
- EXPECT_EQ(0, buckets[0].min);
- EXPECT_EQ(2, buckets[0].count);
- // Second bucket is for 2 budget, which has 1 sample.
- EXPECT_EQ(2, buckets[1].min);
- EXPECT_EQ(1, buckets[1].count);
- // Final bucket is for 4 budget, which has 4 samples.
- EXPECT_EQ(4, buckets[2].min);
- EXPECT_EQ(4, buckets[2].count);
+ ASSERT_EQ(1.0, buckets.size());
+ // The bucket is for budget of 4 (the engagement score), which has 1 samples.
+ EXPECT_EQ(4.0, buckets[0].min);
+ EXPECT_EQ(1, buckets[0].count);
Peter Beverloo 2016/09/05 14:39:03 I'm a wee bit hesitant towards testing the impleme
harkness 2016/09/06 13:28:39 I added tests in budget_database_unittest.cc and r
+ // There should only be 1 entry for NoBudgetOrigin because we only record the
+ // UMA when there needs to be a notification shown and there isn't one.
std::vector<base::Bucket> no_budget_buckets =
GetHistogramTester()->GetAllSamples("PushMessaging.SESForNoBudgetOrigin");
ASSERT_EQ(1.0, no_budget_buckets.size());
EXPECT_EQ(4, no_budget_buckets[0].min);
- EXPECT_EQ(2, no_budget_buckets[0].count);
+ EXPECT_EQ(1, no_budget_buckets[0].count);
+ // There should also be only 1 entry for LowBudgetOrigin.
std::vector<base::Bucket> low_budget_buckets =
GetHistogramTester()->GetAllSamples(
"PushMessaging.SESForLowBudgetOrigin");

Powered by Google App Engine
This is Rietveld 408576698