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

Side by Side Diff: services/preferences/tracked/segregated_pref_store_unittest.cc

Issue 2745563005: Pref service: add support for tracked prefs. (Closed)
Patch Set: deflake tests Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 "services/preferences/tracked/segregated_pref_store.h" 5 #include "services/preferences/tracked/segregated_pref_store.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 void SetUp() override { 67 void SetUp() override {
68 selected_store_ = new TestingPrefStore; 68 selected_store_ = new TestingPrefStore;
69 default_store_ = new TestingPrefStore; 69 default_store_ = new TestingPrefStore;
70 70
71 std::set<std::string> selected_pref_names; 71 std::set<std::string> selected_pref_names;
72 selected_pref_names.insert(kSelectedPref); 72 selected_pref_names.insert(kSelectedPref);
73 selected_pref_names.insert(kSharedPref); 73 selected_pref_names.insert(kSharedPref);
74 74
75 segregated_store_ = new SegregatedPrefStore(default_store_, selected_store_, 75 segregated_store_ = new SegregatedPrefStore(default_store_, selected_store_,
76 selected_pref_names); 76 selected_pref_names, nullptr);
77 77
78 segregated_store_->AddObserver(&observer_); 78 segregated_store_->AddObserver(&observer_);
79 } 79 }
80 80
81 void TearDown() override { segregated_store_->RemoveObserver(&observer_); } 81 void TearDown() override { segregated_store_->RemoveObserver(&observer_); }
82 82
83 protected: 83 protected:
84 std::unique_ptr<PersistentPrefStore::ReadErrorDelegate> 84 std::unique_ptr<PersistentPrefStore::ReadErrorDelegate>
85 GetReadErrorDelegate() { 85 GetReadErrorDelegate() {
86 EXPECT_TRUE(read_error_delegate_); 86 EXPECT_TRUE(read_error_delegate_);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 EXPECT_TRUE(base::Value(kValue1).Equals(value)); 295 EXPECT_TRUE(base::Value(kValue1).Equals(value));
296 296
297 // Check that a a default preference is returned. 297 // Check that a a default preference is returned.
298 ASSERT_TRUE(values->Get(kUnselectedPref, &value)); 298 ASSERT_TRUE(values->Get(kUnselectedPref, &value));
299 EXPECT_TRUE(base::Value(kValue2).Equals(value)); 299 EXPECT_TRUE(base::Value(kValue2).Equals(value));
300 300
301 // Check that the selected preference is preferred. 301 // Check that the selected preference is preferred.
302 ASSERT_TRUE(values->Get(kSharedPref, &value)); 302 ASSERT_TRUE(values->Get(kSharedPref, &value));
303 EXPECT_TRUE(base::Value(kValue1).Equals(value)); 303 EXPECT_TRUE(base::Value(kValue1).Equals(value));
304 } 304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698