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

Side by Side Diff: components/data_use_measurement/content/data_use_measurement_unittest.cc

Issue 2269833002: Refactor the DataUseMeasurement class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More mechanical changes Created 4 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 unified diff | Download patch
« no previous file with comments | « components/data_use_measurement/content/data_use_measurement.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_use_measurement/content/data_use_measurement.h" 5 #include "components/data_use_measurement/content/data_use_measurement.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 data_use_measurement::DataUseUserData::SUGGESTIONS)); 58 data_use_measurement::DataUseUserData::SUGGESTIONS));
59 } else { 59 } else {
60 content::ResourceRequestInfo::AllocateForTesting( 60 content::ResourceRequestInfo::AllocateForTesting(
61 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2, 61 request.get(), content::RESOURCE_TYPE_MAIN_FRAME, nullptr, -2, -2, -2,
62 true, false, true, true, false); 62 true, false, true, true, false);
63 } 63 }
64 64
65 request->Start(); 65 request->Start();
66 loop_.RunUntilIdle(); 66 loop_.RunUntilIdle();
67 67
68 data_use_measurement_.ReportDataUseUMA(request.get()); 68 data_use_measurement_.OnCompleted(*request, true);
69 } 69 }
70 70
71 // This function makes a user request and confirms that its effect is 71 // This function makes a user request and confirms that its effect is
72 // reflected in proper histograms. 72 // reflected in proper histograms.
73 void TestForAUserRequest(const std::string& target_dimension) { 73 void TestForAUserRequest(const std::string& target_dimension) {
74 base::HistogramTester histogram_tester; 74 base::HistogramTester histogram_tester;
75 SendRequest(true); 75 SendRequest(true);
76 histogram_tester.ExpectTotalCount("DataUse.TrafficSize.System.Downstream." + 76 histogram_tester.ExpectTotalCount("DataUse.TrafficSize.System.Downstream." +
77 target_dimension + kConnectionType, 77 target_dimension + kConnectionType,
78 1); 78 1);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 #endif 159 #endif
160 160
161 TEST_F(DataUseMeasurementTest, DataUseForwarderIsCalled) { 161 TEST_F(DataUseMeasurementTest, DataUseForwarderIsCalled) {
162 EXPECT_FALSE(IsDataUseForwarderCalled()); 162 EXPECT_FALSE(IsDataUseForwarderCalled());
163 SendRequest(true); 163 SendRequest(true);
164 EXPECT_TRUE(IsDataUseForwarderCalled()); 164 EXPECT_TRUE(IsDataUseForwarderCalled());
165 } 165 }
166 166
167 } // namespace data_use_measurement 167 } // namespace data_use_measurement
OLDNEW
« no previous file with comments | « components/data_use_measurement/content/data_use_measurement.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698