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

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

Issue 2447013003: Remove unused DRP code for migrating prefs (Closed)
Patch Set: Created 4 years, 2 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_prefs_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc
index 20032c0df8fe43485262cb6e3e043d3412e90e91..beabdfb174a6b1039f2b342b64d380d966083f10 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs_unittest.cc
@@ -22,8 +22,6 @@ class DataReductionProxyPrefsTest : public testing::Test {
RegisterPrefs(local_state_prefs_.registry());
PrefRegistrySimple* profile_registry = profile_prefs_.registry();
RegisterPrefs(profile_registry);
- profile_registry->RegisterBooleanPref(
- prefs::kStatisticsPrefsMigrated, false);
}
PrefService* local_state_prefs() {
@@ -92,126 +90,4 @@ class DataReductionProxyPrefsTest : public testing::Test {
TestingPrefServiceSimple profile_prefs_;
};
-TEST_F(DataReductionProxyPrefsTest, TestMigration) {
- local_state_prefs()->SetInt64(prefs::kHttpReceivedContentLength, 123L);
- local_state_prefs()->SetInt64(prefs::kHttpOriginalContentLength, 234L);
- local_state_prefs()->SetInt64(
- prefs::kDailyHttpContentLengthLastUpdateDate, 345L);
- InitializeList(
- prefs::kDailyHttpOriginalContentLength, 0L, local_state_prefs());
- InitializeList(
- prefs::kDailyHttpReceivedContentLength, 1L, local_state_prefs());
- InitializeList(
- prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled,
- 2L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthWithDataReductionProxyEnabled,
- 3L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled,
- 4L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled,
- 5L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled,
- 6L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled,
- 7L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyOriginalContentLengthViaDataReductionProxy,
- 8L,
- local_state_prefs());
- InitializeList(
- prefs::kDailyContentLengthViaDataReductionProxy,
- 9L,
- local_state_prefs());
-
- EXPECT_EQ(0L, profile_prefs()->GetInt64(prefs::kHttpReceivedContentLength));
- EXPECT_EQ(0L, profile_prefs()->GetInt64(prefs::kHttpOriginalContentLength));
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyHttpOriginalContentLength)->GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyHttpReceivedContentLength)->GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled)->
- GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthWithDataReductionProxyEnabled)->GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled)->GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled)->
- GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled)->
- GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled)->
- GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyOriginalContentLengthViaDataReductionProxy)->GetSize());
- EXPECT_EQ(0u, profile_prefs()->GetList(
- prefs::kDailyContentLengthViaDataReductionProxy)->GetSize());
- EXPECT_EQ(0L, profile_prefs()->GetInt64(
- prefs::kDailyHttpContentLengthLastUpdateDate));
- EXPECT_FALSE(profile_prefs()->GetBoolean(prefs::kStatisticsPrefsMigrated));
-
- data_reduction_proxy::MigrateStatisticsPrefs(local_state_prefs(),
- profile_prefs());
-
- EXPECT_EQ(123L, profile_prefs()->GetInt64(prefs::kHttpReceivedContentLength));
- EXPECT_EQ(234L, profile_prefs()->GetInt64(prefs::kHttpOriginalContentLength));
- VerifyList(prefs::kDailyHttpOriginalContentLength, 0L, profile_prefs());
- VerifyList(prefs::kDailyHttpReceivedContentLength, 1L, profile_prefs());
- VerifyList(
- prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled,
- 2L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthWithDataReductionProxyEnabled,
- 3L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthHttpsWithDataReductionProxyEnabled,
- 4L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthShortBypassWithDataReductionProxyEnabled,
- 5L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthLongBypassWithDataReductionProxyEnabled,
- 6L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthUnknownWithDataReductionProxyEnabled,
- 7L,
- profile_prefs());
- VerifyList(
- prefs::kDailyOriginalContentLengthViaDataReductionProxy,
- 8L,
- profile_prefs());
- VerifyList(
- prefs::kDailyContentLengthViaDataReductionProxy,
- 9L,
- profile_prefs());
- EXPECT_EQ(345L, profile_prefs()->GetInt64(
- prefs::kDailyHttpContentLengthLastUpdateDate));
- EXPECT_TRUE(profile_prefs()->GetBoolean(prefs::kStatisticsPrefsMigrated));
-
- // Migration should only happen once.
- local_state_prefs()->SetInt64(prefs::kHttpReceivedContentLength, 456L);
- data_reduction_proxy::MigrateStatisticsPrefs(local_state_prefs(),
- profile_prefs());
- EXPECT_EQ(123L, profile_prefs()->GetInt64(prefs::kHttpReceivedContentLength));
-}
-
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698