| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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 "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
     s.h" |    5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
     s.h" | 
|    6  |    6  | 
|    7 #include "base/prefs/pref_registry_simple.h" |    7 #include "base/prefs/pref_registry_simple.h" | 
|    8 #include "base/prefs/pref_service.h" |    8 #include "base/prefs/pref_service.h" | 
|    9 #include "base/prefs/scoped_user_pref_update.h" |    9 #include "base/prefs/scoped_user_pref_update.h" | 
|   10 #include "base/prefs/testing_pref_service.h" |   10 #include "base/prefs/testing_pref_service.h" | 
|   11 #include "base/strings/string_number_conversions.h" |   11 #include "base/strings/string_number_conversions.h" | 
|   12 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
     names.h" |   12 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_
     names.h" | 
|   13 #include "testing/gtest/include/gtest/gtest.h" |   13 #include "testing/gtest/include/gtest/gtest.h" | 
|   14  |   14  | 
|   15 namespace data_reduction_proxy { |   15 namespace data_reduction_proxy { | 
|   16  |   16  | 
|   17 class DataReductionProxyPrefsTest : public testing::Test { |   17 class DataReductionProxyPrefsTest : public testing::Test { | 
|   18  public: |   18  public: | 
|   19   virtual void SetUp() override { |   19   void SetUp() override { | 
|   20     RegisterPrefs(local_state_prefs_.registry()); |   20     RegisterPrefs(local_state_prefs_.registry()); | 
|   21     PrefRegistrySimple* profile_registry = profile_prefs_.registry(); |   21     PrefRegistrySimple* profile_registry = profile_prefs_.registry(); | 
|   22     RegisterPrefs(profile_registry); |   22     RegisterPrefs(profile_registry); | 
|   23     profile_registry->RegisterBooleanPref( |   23     profile_registry->RegisterBooleanPref( | 
|   24         prefs::kStatisticsPrefsMigrated, false); |   24         prefs::kStatisticsPrefsMigrated, false); | 
|   25   } |   25   } | 
|   26  |   26  | 
|   27   PrefService* local_state_prefs() { |   27   PrefService* local_state_prefs() { | 
|   28     return &local_state_prefs_; |   28     return &local_state_prefs_; | 
|   29   } |   29   } | 
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  206   EXPECT_TRUE(profile_prefs()->GetBoolean(prefs::kStatisticsPrefsMigrated)); |  206   EXPECT_TRUE(profile_prefs()->GetBoolean(prefs::kStatisticsPrefsMigrated)); | 
|  207  |  207  | 
|  208   // Migration should only happen once. |  208   // Migration should only happen once. | 
|  209   local_state_prefs()->SetInt64(prefs::kHttpReceivedContentLength, 456L); |  209   local_state_prefs()->SetInt64(prefs::kHttpReceivedContentLength, 456L); | 
|  210   data_reduction_proxy::MigrateStatisticsPrefs(local_state_prefs(), |  210   data_reduction_proxy::MigrateStatisticsPrefs(local_state_prefs(), | 
|  211                                                profile_prefs()); |  211                                                profile_prefs()); | 
|  212   EXPECT_EQ(123L, profile_prefs()->GetInt64(prefs::kHttpReceivedContentLength)); |  212   EXPECT_EQ(123L, profile_prefs()->GetInt64(prefs::kHttpReceivedContentLength)); | 
|  213 } |  213 } | 
|  214  |  214  | 
|  215 }  // namespace data_reduction_proxy |  215 }  // namespace data_reduction_proxy | 
| OLD | NEW |