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

Unified Diff: services/preferences/tracked/tracked_preferences_migration_unittest.cc

Issue 2782803002: Move tracked prefs into services/preferences/tracked. (Closed)
Patch Set: rebase Created 3 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: services/preferences/tracked/tracked_preferences_migration_unittest.cc
diff --git a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc b/services/preferences/tracked/tracked_preferences_migration_unittest.cc
similarity index 90%
rename from components/user_prefs/tracked/tracked_preferences_migration_unittest.cc
rename to services/preferences/tracked/tracked_preferences_migration_unittest.cc
index 213d431a6d783b16f3ac979ebcc212eede48e7d6..fdbdd099d3d1034de015b9baf9fb8e49c60d1956 100644
--- a/components/user_prefs/tracked/tracked_preferences_migration_unittest.cc
+++ b/services/preferences/tracked/tracked_preferences_migration_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/user_prefs/tracked/tracked_preferences_migration.h"
+#include "services/preferences/tracked/tracked_preferences_migration.h"
#include <memory>
#include <set>
@@ -16,13 +16,12 @@
#include "base/strings/string_split.h"
#include "base/values.h"
#include "components/prefs/testing_pref_service.h"
-#include "components/user_prefs/tracked/dictionary_hash_store_contents.h"
-#include "components/user_prefs/tracked/hash_store_contents.h"
-#include "components/user_prefs/tracked/interceptable_pref_filter.h"
-#include "components/user_prefs/tracked/pref_hash_store.h"
-#include "components/user_prefs/tracked/pref_hash_store_impl.h"
-#include "components/user_prefs/tracked/pref_hash_store_transaction.h"
-#include "components/user_prefs/tracked/tracked_preferences_migration.h"
+#include "services/preferences/tracked/dictionary_hash_store_contents.h"
+#include "services/preferences/tracked/hash_store_contents.h"
+#include "services/preferences/tracked/interceptable_pref_filter.h"
+#include "services/preferences/tracked/pref_hash_store.h"
+#include "services/preferences/tracked/pref_hash_store_impl.h"
+#include "services/preferences/tracked/pref_hash_store_transaction.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -87,9 +86,7 @@ class TrackedPreferencesMigrationTest : public testing::Test {
unprotected_store_migration_complete_(false),
protected_store_migration_complete_(false) {}
- void SetUp() override {
- Reset();
- }
+ void SetUp() override { Reset(); }
void Reset() {
std::set<std::string> unprotected_pref_names;
@@ -183,9 +180,8 @@ class TrackedPreferencesMigrationTest : public testing::Test {
// Verifies that the (key, value) pairs in |expected_prefs_in_store| are found
// in the store identified by |store_id|.
- void VerifyValuesStored(
- MockPrefStoreID store_id,
- const base::StringPairs& expected_prefs_in_store) {
+ void VerifyValuesStored(MockPrefStoreID store_id,
+ const base::StringPairs& expected_prefs_in_store) {
base::DictionaryValue* store = NULL;
switch (store_id) {
case MOCK_UNPROTECTED_PREF_STORE:
@@ -269,7 +265,7 @@ class TrackedPreferencesMigrationTest : public testing::Test {
bool MigrationCompleted() {
return unprotected_store_migration_complete_ &&
- protected_store_migration_complete_;
+ protected_store_migration_complete_;
}
void SimulateSuccessfulWrite(MockPrefStoreID store_id) {
@@ -440,15 +436,13 @@ TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) {
}
TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
- PresetStoreValue(
- MOCK_UNPROTECTED_PREF_STORE, kUnprotectedPref, kUnprotectedPrefValue);
- PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE,
- kPreviouslyUnprotectedPref,
+ PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE, kUnprotectedPref,
+ kUnprotectedPrefValue);
+ PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE, kPreviouslyUnprotectedPref,
kPreviouslyUnprotectedPrefValue);
- PresetStoreValue(
- MOCK_PROTECTED_PREF_STORE, kProtectedPref, kProtectedPrefValue);
- PresetStoreValue(MOCK_PROTECTED_PREF_STORE,
- kPreviouslyProtectedPref,
+ PresetStoreValue(MOCK_PROTECTED_PREF_STORE, kProtectedPref,
+ kProtectedPrefValue);
+ PresetStoreValue(MOCK_PROTECTED_PREF_STORE, kPreviouslyProtectedPref,
kPreviouslyProtectedPrefValue);
EXPECT_TRUE(ContainsHash(MOCK_UNPROTECTED_PREF_STORE, kUnprotectedPref));
@@ -486,8 +480,8 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
// still remain in the source store until cleanup tasks are later invoked.
{
base::StringPairs expected_unprotected_values;
- expected_unprotected_values.push_back(std::make_pair(
- kUnprotectedPref, kUnprotectedPrefValue));
+ expected_unprotected_values.push_back(
+ std::make_pair(kUnprotectedPref, kUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
kPreviouslyProtectedPref, kPreviouslyProtectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
@@ -496,8 +490,8 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
expected_unprotected_values);
base::StringPairs expected_protected_values;
- expected_protected_values.push_back(std::make_pair(
- kProtectedPref, kProtectedPrefValue));
+ expected_protected_values.push_back(
+ std::make_pair(kProtectedPref, kProtectedPrefValue));
expected_protected_values.push_back(std::make_pair(
kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
@@ -525,16 +519,16 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
{
base::StringPairs expected_unprotected_values;
- expected_unprotected_values.push_back(std::make_pair(
- kUnprotectedPref, kUnprotectedPrefValue));
+ expected_unprotected_values.push_back(
+ std::make_pair(kUnprotectedPref, kUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
kPreviouslyProtectedPref, kPreviouslyProtectedPrefValue));
VerifyValuesStored(MOCK_UNPROTECTED_PREF_STORE,
expected_unprotected_values);
base::StringPairs expected_protected_values;
- expected_protected_values.push_back(std::make_pair(
- kProtectedPref, kProtectedPrefValue));
+ expected_protected_values.push_back(
+ std::make_pair(kProtectedPref, kProtectedPrefValue));
expected_protected_values.push_back(std::make_pair(
kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
@@ -546,16 +540,16 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
{
base::StringPairs expected_unprotected_values;
- expected_unprotected_values.push_back(std::make_pair(
- kUnprotectedPref, kUnprotectedPrefValue));
+ expected_unprotected_values.push_back(
+ std::make_pair(kUnprotectedPref, kUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
kPreviouslyProtectedPref, kPreviouslyProtectedPrefValue));
VerifyValuesStored(MOCK_UNPROTECTED_PREF_STORE,
expected_unprotected_values);
base::StringPairs expected_protected_values;
- expected_protected_values.push_back(std::make_pair(
- kProtectedPref, kProtectedPrefValue));
+ expected_protected_values.push_back(
+ std::make_pair(kProtectedPref, kProtectedPrefValue));
expected_protected_values.push_back(std::make_pair(
kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values);
@@ -600,21 +594,17 @@ TEST_F(TrackedPreferencesMigrationTest, FullMigration) {
TEST_F(TrackedPreferencesMigrationTest, CleanupOnly) {
// Already migrated; only cleanup needed.
- PresetStoreValue(
- MOCK_UNPROTECTED_PREF_STORE, kUnprotectedPref, kUnprotectedPrefValue);
- PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE,
- kPreviouslyProtectedPref,
+ PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE, kUnprotectedPref,
+ kUnprotectedPrefValue);
+ PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE, kPreviouslyProtectedPref,
kPreviouslyProtectedPrefValue);
- PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE,
- kPreviouslyUnprotectedPref,
+ PresetStoreValue(MOCK_UNPROTECTED_PREF_STORE, kPreviouslyUnprotectedPref,
kPreviouslyUnprotectedPrefValue);
- PresetStoreValue(
- MOCK_PROTECTED_PREF_STORE, kProtectedPref, kProtectedPrefValue);
- PresetStoreValue(MOCK_PROTECTED_PREF_STORE,
- kPreviouslyProtectedPref,
+ PresetStoreValue(MOCK_PROTECTED_PREF_STORE, kProtectedPref,
+ kProtectedPrefValue);
+ PresetStoreValue(MOCK_PROTECTED_PREF_STORE, kPreviouslyProtectedPref,
kPreviouslyProtectedPrefValue);
- PresetStoreValue(MOCK_PROTECTED_PREF_STORE,
- kPreviouslyUnprotectedPref,
+ PresetStoreValue(MOCK_PROTECTED_PREF_STORE, kPreviouslyUnprotectedPref,
kPreviouslyUnprotectedPrefValue);
HandPrefsToMigrator(MOCK_UNPROTECTED_PREF_STORE);
@@ -638,16 +628,16 @@ TEST_F(TrackedPreferencesMigrationTest, CleanupOnly) {
// their destination stores.
{
base::StringPairs expected_unprotected_values;
- expected_unprotected_values.push_back(std::make_pair(
- kUnprotectedPref, kUnprotectedPrefValue));
+ expected_unprotected_values.push_back(
+ std::make_pair(kUnprotectedPref, kUnprotectedPrefValue));
expected_unprotected_values.push_back(std::make_pair(
kPreviouslyProtectedPref, kPreviouslyProtectedPrefValue));
VerifyValuesStored(MOCK_UNPROTECTED_PREF_STORE,
expected_unprotected_values);
base::StringPairs expected_protected_values;
- expected_protected_values.push_back(std::make_pair(
- kProtectedPref, kProtectedPrefValue));
+ expected_protected_values.push_back(
+ std::make_pair(kProtectedPref, kProtectedPrefValue));
expected_protected_values.push_back(std::make_pair(
kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values);
« no previous file with comments | « services/preferences/tracked/tracked_preferences_migration.cc ('k') | services/preferences/tracked/tracked_split_preference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698