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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_unittest.cc

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
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_reduction_proxy/core/browser/data_reduction_proxy_conf ig.h" 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf ig.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 #include <utility> 12 #include <utility>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
18 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
19 #include "base/strings/safe_sprintf.h" 20 #include "base/strings/safe_sprintf.h"
20 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 &test_network_quality_estimator)); 996 &test_network_quality_estimator));
996 997
997 // Change in connection type changes the network quality despite hysteresis. 998 // Change in connection type changes the network quality despite hysteresis.
998 config.connection_type_ = net::NetworkChangeNotifier::CONNECTION_WIFI; 999 config.connection_type_ = net::NetworkChangeNotifier::CONNECTION_WIFI;
999 EXPECT_TRUE(config.IsNetworkQualityProhibitivelySlow( 1000 EXPECT_TRUE(config.IsNetworkQualityProhibitivelySlow(
1000 &test_network_quality_estimator)); 1001 &test_network_quality_estimator));
1001 } 1002 }
1002 1003
1003 // Tests if metrics for Lo-Fi accuracy are recorded properly. 1004 // Tests if metrics for Lo-Fi accuracy are recorded properly.
1004 TEST_F(DataReductionProxyConfigTest, LoFiAccuracy) { 1005 TEST_F(DataReductionProxyConfigTest, LoFiAccuracy) {
1005 scoped_ptr<base::SimpleTestTickClock> tick_clock( 1006 std::unique_ptr<base::SimpleTestTickClock> tick_clock(
1006 new base::SimpleTestTickClock()); 1007 new base::SimpleTestTickClock());
1007 1008
1008 std::vector<base::TimeDelta> lofi_accuracy_recording_intervals; 1009 std::vector<base::TimeDelta> lofi_accuracy_recording_intervals;
1009 lofi_accuracy_recording_intervals.push_back(base::TimeDelta::FromSeconds(0)); 1010 lofi_accuracy_recording_intervals.push_back(base::TimeDelta::FromSeconds(0));
1010 1011
1011 TestDataReductionProxyConfig config( 1012 TestDataReductionProxyConfig config(
1012 DataReductionProxyParams::kAllowed | 1013 DataReductionProxyParams::kAllowed |
1013 DataReductionProxyParams::kFallbackAllowed, 1014 DataReductionProxyParams::kFallbackAllowed,
1014 TestDataReductionProxyParams::HAS_EVERYTHING, task_runner(), nullptr, 1015 TestDataReductionProxyParams::HAS_EVERYTHING, task_runner(), nullptr,
1015 configurator(), event_creator()); 1016 configurator(), event_creator());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 "DataReductionProxy.LoFi.Accuracy.0.Unknown", 1); 1090 "DataReductionProxy.LoFi.Accuracy.0.Unknown", 1);
1090 histogram_tester.ExpectBucketCount( 1091 histogram_tester.ExpectBucketCount(
1091 "DataReductionProxy.LoFi.Accuracy.0.Unknown", test.bucket_to_check, 1092 "DataReductionProxy.LoFi.Accuracy.0.Unknown", test.bucket_to_check,
1092 test.expected_bucket_count); 1093 test.expected_bucket_count);
1093 } 1094 }
1094 } 1095 }
1095 1096
1096 // Tests if metrics for Lo-Fi accuracy are recorded properly at the specified 1097 // Tests if metrics for Lo-Fi accuracy are recorded properly at the specified
1097 // interval. 1098 // interval.
1098 TEST_F(DataReductionProxyConfigTest, LoFiAccuracyNonZeroDelay) { 1099 TEST_F(DataReductionProxyConfigTest, LoFiAccuracyNonZeroDelay) {
1099 scoped_ptr<base::SimpleTestTickClock> tick_clock( 1100 std::unique_ptr<base::SimpleTestTickClock> tick_clock(
1100 new base::SimpleTestTickClock()); 1101 new base::SimpleTestTickClock());
1101 1102
1102 std::vector<base::TimeDelta> lofi_accuracy_recording_intervals; 1103 std::vector<base::TimeDelta> lofi_accuracy_recording_intervals;
1103 lofi_accuracy_recording_intervals.push_back(base::TimeDelta::FromSeconds(1)); 1104 lofi_accuracy_recording_intervals.push_back(base::TimeDelta::FromSeconds(1));
1104 1105
1105 TestDataReductionProxyConfig config( 1106 TestDataReductionProxyConfig config(
1106 DataReductionProxyParams::kAllowed | 1107 DataReductionProxyParams::kAllowed |
1107 DataReductionProxyParams::kFallbackAllowed, 1108 DataReductionProxyParams::kFallbackAllowed,
1108 TestDataReductionProxyParams::HAS_EVERYTHING, task_runner(), nullptr, 1109 TestDataReductionProxyParams::HAS_EVERYTHING, task_runner(), nullptr,
1109 configurator(), event_creator()); 1110 configurator(), event_creator());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 // Sleep to ensure that the delayed task is posted. 1147 // Sleep to ensure that the delayed task is posted.
1147 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); 1148 base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
1148 RunUntilIdle(); 1149 RunUntilIdle();
1149 histogram_tester.ExpectTotalCount( 1150 histogram_tester.ExpectTotalCount(
1150 "DataReductionProxy.LoFi.Accuracy.1.Unknown", 1); 1151 "DataReductionProxy.LoFi.Accuracy.1.Unknown", 1);
1151 histogram_tester.ExpectBucketCount( 1152 histogram_tester.ExpectBucketCount(
1152 "DataReductionProxy.LoFi.Accuracy.1.Unknown", 0, 1); 1153 "DataReductionProxy.LoFi.Accuracy.1.Unknown", 0, 1);
1153 } 1154 }
1154 1155
1155 } // namespace data_reduction_proxy 1156 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698