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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc

Issue 989663002: HistoricNetworkStatsInfoToValue should use statistics prefs values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 5 years, 9 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index 3e91abfa8a610416a7cfa12b8fcf79b1b34a59d3..f88505afa47bef158a1365eb16f425cb409c58e4 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -450,64 +450,4 @@ TEST_F(DataReductionProxyNetworkDelegateTest, TotalLengths) {
data_reduction_proxy::prefs::kHttpOriginalContentLength));
}
-class DataReductionProxyHistoricNetworkStatsTest
- : public testing::Test {
- public:
- DataReductionProxyHistoricNetworkStatsTest() {
- }
-
- void SetUp() override {
- simple_pref_service_.registry()->RegisterInt64Pref(
- prefs::kHttpReceivedContentLength, 0);
- simple_pref_service_.registry()->RegisterInt64Pref(
- prefs::kHttpOriginalContentLength, 0);
- }
-
- // Verify the pref values in |dict| are equal to that in
- // |simple_pref_service|.
- void VerifyPrefs(base::DictionaryValue* dict) {
- base::string16 dict_pref_string;
- int64 dict_pref;
- int64 service_pref;
-
- dict->GetString("historic_original_content_length", &dict_pref_string);
- base::StringToInt64(dict_pref_string, &dict_pref);
- service_pref = simple_pref_service_.GetInt64(
- prefs::kHttpOriginalContentLength);
- EXPECT_EQ(service_pref, dict_pref);
-
- dict->GetString("historic_received_content_length", &dict_pref_string);
- base::StringToInt64(dict_pref_string, &dict_pref);
- service_pref = simple_pref_service_.GetInt64(
- prefs::kHttpReceivedContentLength);
- EXPECT_EQ(service_pref, dict_pref);
- }
-
- TestingPrefServiceSimple simple_pref_service_;
-};
-
-TEST_F(DataReductionProxyHistoricNetworkStatsTest,
- HistoricNetworkStatsInfoToValue) {
- const int64 kOriginalLength = 150;
- const int64 kReceivedLength = 100;
-
- base::DictionaryValue* dict = nullptr;
- scoped_ptr<base::Value> stats_value(
- DataReductionProxyNetworkDelegate::HistoricNetworkStatsInfoToValue(
- &simple_pref_service_));
- EXPECT_TRUE(stats_value->GetAsDictionary(&dict));
- VerifyPrefs(dict);
-
- simple_pref_service_.SetInt64(prefs::kHttpOriginalContentLength,
- kOriginalLength);
- simple_pref_service_.SetInt64(prefs::kHttpReceivedContentLength,
- kReceivedLength);
-
- stats_value.reset(
- DataReductionProxyNetworkDelegate::HistoricNetworkStatsInfoToValue(
- &simple_pref_service_));
- EXPECT_TRUE(stats_value->GetAsDictionary(&dict));
- VerifyPrefs(dict);
-}
-
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698