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

Unified Diff: net/url_request/url_request_throttler_unittest.cc

Issue 379283002: Rework UMAHistogramHelper and StatisticsDeltaReader into [Chrome]HistogramTester. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 | « net/spdy/spdy_session_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_throttler_unittest.cc
diff --git a/net/url_request/url_request_throttler_unittest.cc b/net/url_request/url_request_throttler_unittest.cc
index 9ae9c7b1c91a22a76348e91b669114f11a1410d8..4d08cbc568356c05abc9feac0b596d6d86b56880 100644
--- a/net/url_request/url_request_throttler_unittest.cc
+++ b/net/url_request/url_request_throttler_unittest.cc
@@ -10,7 +10,7 @@
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
-#include "base/test/statistics_delta_reader.h"
+#include "base/test/histogram_tester.h"
#include "base/time/time.h"
#include "net/base/load_flags.h"
#include "net/base/request_priority.h"
@@ -209,7 +209,7 @@ TEST_F(URLRequestThrottlerEntryTest, CanThrottleRequest) {
}
TEST_F(URLRequestThrottlerEntryTest, InterfaceDuringExponentialBackoff) {
- base::StatisticsDeltaReader statistics_delta_reader;
+ base::HistogramTester histogram_tester;
entry_->set_exponential_backoff_release_time(
entry_->fake_time_now_ + TimeDelta::FromMilliseconds(1));
EXPECT_TRUE(entry_->ShouldRejectRequest(request_,
@@ -220,15 +220,12 @@ TEST_F(URLRequestThrottlerEntryTest, InterfaceDuringExponentialBackoff) {
EXPECT_FALSE(entry_->ShouldRejectRequest(request_,
context_.network_delegate()));
- scoped_ptr<base::HistogramSamples> samples(
- statistics_delta_reader.GetHistogramSamplesSinceCreation(
- kRequestThrottledHistogramName));
- ASSERT_EQ(1, samples->GetCount(0));
- ASSERT_EQ(1, samples->GetCount(1));
+ histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 0, 1);
+ histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 1, 1);
}
TEST_F(URLRequestThrottlerEntryTest, InterfaceNotDuringExponentialBackoff) {
- base::StatisticsDeltaReader statistics_delta_reader;
+ base::HistogramTester histogram_tester;
entry_->set_exponential_backoff_release_time(entry_->fake_time_now_);
EXPECT_FALSE(entry_->ShouldRejectRequest(request_,
context_.network_delegate()));
@@ -237,11 +234,8 @@ TEST_F(URLRequestThrottlerEntryTest, InterfaceNotDuringExponentialBackoff) {
EXPECT_FALSE(entry_->ShouldRejectRequest(request_,
context_.network_delegate()));
- scoped_ptr<base::HistogramSamples> samples(
- statistics_delta_reader.GetHistogramSamplesSinceCreation(
- kRequestThrottledHistogramName));
- ASSERT_EQ(2, samples->GetCount(0));
- ASSERT_EQ(0, samples->GetCount(1));
+ histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 0, 2);
+ histogram_tester.ExpectBucketCount(kRequestThrottledHistogramName, 1, 0);
}
TEST_F(URLRequestThrottlerEntryTest, InterfaceUpdateFailure) {
« no previous file with comments | « net/spdy/spdy_session_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698