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

Side by Side Diff: services/preferences/public/cpp/tests/pref_store_client_unittest.cc

Issue 2743563003: Pref service: add persistent pref store frontend and backend. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/public/cpp/pref_store_client.h" 5 #include "services/preferences/public/cpp/pref_store_client.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 25 matching lines...) Expand all
36 } // namespace 36 } // namespace
37 37
38 class PrefStoreClientTest : public testing::Test { 38 class PrefStoreClientTest : public testing::Test {
39 public: 39 public:
40 PrefStoreClientTest() = default; 40 PrefStoreClientTest() = default;
41 ~PrefStoreClientTest() override {} 41 ~PrefStoreClientTest() override {}
42 42
43 PrefStoreObserverMock& observer() { return observer_; } 43 PrefStoreObserverMock& observer() { return observer_; }
44 PrefStoreClient* store() { return store_.get(); } 44 PrefStoreClient* store() { return store_.get(); }
45 45
46 bool initialized() { return store_->initialized_; } 46 bool initialized() { return store_->IsInitializationComplete(); }
47 void OnPrefChanged(const std::string& key, const base::Value& value) { 47 void OnPrefChanged(const std::string& key, const base::Value& value) {
48 observer_ptr_->OnPrefChanged(key, value.CreateDeepCopy()); 48 observer_ptr_->OnPrefChanged(key, value.CreateDeepCopy());
49 } 49 }
50 void OnInitializationCompleted() { 50 void OnInitializationCompleted() {
51 observer_ptr_->OnInitializationCompleted(true); 51 observer_ptr_->OnInitializationCompleted(true);
52 } 52 }
53 53
54 // testing::Test: 54 // testing::Test:
55 void SetUp() override { 55 void SetUp() override {
56 store_ = new PrefStoreClient(mojom::PrefStoreConnection::New( 56 store_ = new PrefStoreClient(mojom::PrefStoreConnection::New(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 EXPECT_TRUE(value->GetAsInteger(&actual_value)); 183 EXPECT_TRUE(value->GetAsInteger(&actual_value));
184 EXPECT_EQ(kValue, actual_value); 184 EXPECT_EQ(kValue, actual_value);
185 EXPECT_CALL(observer, OnInitializationCompleted(_)).Times(0); 185 EXPECT_CALL(observer, OnInitializationCompleted(_)).Times(0);
186 EXPECT_CALL(observer, OnPrefValueChanged(_)).Times(0); 186 EXPECT_CALL(observer, OnPrefValueChanged(_)).Times(0);
187 observer_ptr.FlushForTesting(); 187 observer_ptr.FlushForTesting();
188 188
189 store->RemoveObserver(&observer); 189 store->RemoveObserver(&observer);
190 } 190 }
191 191
192 } // namespace prefs 192 } // namespace prefs
OLDNEW
« no previous file with comments | « services/preferences/public/cpp/tests/BUILD.gn ('k') | services/preferences/public/interfaces/preferences.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698