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

Side by Side Diff: net/base/network_quality_estimator_unittest.cc

Issue 1378123003: Adding SSL ETS Tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ets
Patch Set: Rebase. Created 5 years, 1 month 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 | « net/android/traffic_stats_unittest.cc ('k') | net/cert_net/cert_net_fetcher_impl_unittest.cc » ('j') | 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 "net/base/network_quality_estimator.h" 5 #include "net/base/network_quality_estimator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 28 matching lines...) Expand all
39 TestNetworkQualityEstimator( 39 TestNetworkQualityEstimator(
40 const std::map<std::string, std::string>& variation_params, 40 const std::map<std::string, std::string>& variation_params,
41 scoped_ptr<net::ExternalEstimateProvider> external_estimate_provider) 41 scoped_ptr<net::ExternalEstimateProvider> external_estimate_provider)
42 : NetworkQualityEstimator(external_estimate_provider.Pass(), 42 : NetworkQualityEstimator(external_estimate_provider.Pass(),
43 variation_params, 43 variation_params,
44 true, 44 true,
45 true) { 45 true) {
46 // Set up embedded test server. 46 // Set up embedded test server.
47 embedded_test_server_.ServeFilesFromDirectory( 47 embedded_test_server_.ServeFilesFromDirectory(
48 base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))); 48 base::FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest")));
49 EXPECT_TRUE(embedded_test_server_.InitializeAndWaitUntilReady()); 49 EXPECT_TRUE(embedded_test_server_.Start());
50 embedded_test_server_.RegisterRequestHandler(base::Bind( 50 embedded_test_server_.RegisterRequestHandler(base::Bind(
51 &TestNetworkQualityEstimator::HandleRequest, base::Unretained(this))); 51 &TestNetworkQualityEstimator::HandleRequest, base::Unretained(this)));
52 } 52 }
53 53
54 explicit TestNetworkQualityEstimator( 54 explicit TestNetworkQualityEstimator(
55 const std::map<std::string, std::string>& variation_params) 55 const std::map<std::string, std::string>& variation_params)
56 : TestNetworkQualityEstimator( 56 : TestNetworkQualityEstimator(
57 variation_params, 57 variation_params,
58 scoped_ptr<net::ExternalEstimateProvider>()) {} 58 scoped_ptr<net::ExternalEstimateProvider>()) {}
59 59
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // id (instead of invoking platform APIs). 92 // id (instead of invoking platform APIs).
93 NetworkQualityEstimator::NetworkID GetCurrentNetworkID() const override { 93 NetworkQualityEstimator::NetworkID GetCurrentNetworkID() const override {
94 return NetworkQualityEstimator::NetworkID(current_network_type_, 94 return NetworkQualityEstimator::NetworkID(current_network_type_,
95 current_network_id_); 95 current_network_id_);
96 } 96 }
97 97
98 net::NetworkChangeNotifier::ConnectionType current_network_type_; 98 net::NetworkChangeNotifier::ConnectionType current_network_type_;
99 std::string current_network_id_; 99 std::string current_network_id_;
100 100
101 // Embedded server used for testing. 101 // Embedded server used for testing.
102 net::test_server::EmbeddedTestServer embedded_test_server_; 102 net::EmbeddedTestServer embedded_test_server_;
103 103
104 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator); 104 DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityEstimator);
105 }; 105 };
106 106
107 class TestRTTObserver : public net::NetworkQualityEstimator::RTTObserver { 107 class TestRTTObserver : public net::NetworkQualityEstimator::RTTObserver {
108 public: 108 public:
109 struct Observation { 109 struct Observation {
110 Observation(int32_t ms, 110 Observation(int32_t ms,
111 const base::TimeTicks& ts, 111 const base::TimeTicks& ts,
112 net::NetworkQualityEstimator::ObservationSource src) 112 net::NetworkQualityEstimator::ObservationSource src)
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 EXPECT_EQ(NetworkQualityEstimator::URL_REQUEST, observation.source); 1054 EXPECT_EQ(NetworkQualityEstimator::URL_REQUEST, observation.source);
1055 } 1055 }
1056 for (auto observation : throughput_observer.observations()) { 1056 for (auto observation : throughput_observer.observations()) {
1057 EXPECT_LE(0, observation.throughput_kbps); 1057 EXPECT_LE(0, observation.throughput_kbps);
1058 EXPECT_LE(0, (observation.timestamp - then).InMilliseconds()); 1058 EXPECT_LE(0, (observation.timestamp - then).InMilliseconds());
1059 EXPECT_EQ(NetworkQualityEstimator::URL_REQUEST, observation.source); 1059 EXPECT_EQ(NetworkQualityEstimator::URL_REQUEST, observation.source);
1060 } 1060 }
1061 } 1061 }
1062 1062
1063 } // namespace net 1063 } // namespace net
OLDNEW
« no previous file with comments | « net/android/traffic_stats_unittest.cc ('k') | net/cert_net/cert_net_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698