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

Side by Side Diff: content/browser/download/download_stats_unittest.cc

Issue 2885793004: Parallelizable download metrics. (Closed)
Patch Set: Some change according to meeting. Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « content/browser/download/download_stats.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/download/download_stats.h"
6
7 #include "base/test/histogram_tester.h"
8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace content {
12
13 namespace {
14
15 void VerfiyParallelizableAverageStats(int64_t bytes_downloaded,
16 const base::TimeDelta& time_span) {
17 base::HistogramTester histogram_tester;
18 int64_t expected_bandwidth = bytes_downloaded / time_span.InSeconds();
19
20 RecordParallelizableDownloadAverageStats(bytes_downloaded, time_span);
21 histogram_tester.ExpectBucketCount("Download.ParallelizableDownloadBandwidth",
22 expected_bandwidth, 1);
23 histogram_tester.ExpectBucketCount("Download.Parallelizable.DownloadTime",
24 time_span.InMilliseconds(), 1);
25 histogram_tester.ExpectBucketCount("Download.Parallelizable.FileSize",
26 bytes_downloaded / 1024, 1);
27 }
28
29 } // namespace
30
31 TEST(DownloadStatsTest, ParallelizableAverageStats) {
32 VerfiyParallelizableAverageStats(1, base::TimeDelta::FromSeconds(1));
33 VerfiyParallelizableAverageStats(1024 * 1024 * 20,
34 base::TimeDelta::FromSeconds(10));
35 VerfiyParallelizableAverageStats(1024 * 1024 * 1024,
36 base::TimeDelta::FromSeconds(1));
37 }
38
39 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698