| 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
|
|
|