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

Unified Diff: net/nqe/network_quality_estimator_params_unittest.cc

Issue 2858743002: NQE: Move params from the estimator class to the params class (Closed)
Patch Set: ryansturm comments Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/nqe/network_quality_estimator_params.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/network_quality_estimator_params_unittest.cc
diff --git a/net/nqe/network_quality_estimator_params_unittest.cc b/net/nqe/network_quality_estimator_params_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..60776c35579232f618f4a948d45afa9185e3ca46
--- /dev/null
+++ b/net/nqe/network_quality_estimator_params_unittest.cc
@@ -0,0 +1,54 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/nqe/network_quality_estimator_params.h"
+
+#include <map>
+#include <string>
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+namespace nqe {
+
+namespace internal {
+
+namespace {
+
+// Tests if |weight_multiplier_per_second()| returns correct value for various
+// values of half life parameter.
+TEST(NetworkQualityEstimatorParamsTest, HalfLifeParam) {
+ std::map<std::string, std::string> variation_params;
+
+ const struct {
+ std::string description;
+ std::string variation_params_value;
+ double expected_weight_multiplier;
+ } tests[] = {
+ {"Half life parameter is not set, default value should be used",
+ std::string(), 0.988},
+ {"Half life parameter is set to negative, default value should be used",
+ "-100", 0.988},
+ {"Half life parameter is set to zero, default value should be used", "0",
+ 0.988},
+ {"Half life parameter is set correctly", "10", 0.933},
+ };
+
+ for (const auto& test : tests) {
+ variation_params["HalfLifeSeconds"] = test.variation_params_value;
+ NetworkQualityEstimatorParams params(variation_params);
+ EXPECT_NEAR(test.expected_weight_multiplier,
+ params.weight_multiplier_per_second(), 0.001)
+ << test.description;
+ }
+}
+
+} // namespace
+
+} // namespace internal
+
+} // namespace nqe
+
+} // namespace net
« no previous file with comments | « net/nqe/network_quality_estimator_params.cc ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698