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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/prefs/testing_pref_store.h" | 9 #include "base/prefs/testing_pref_store.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 base::DictionaryValue* changed_prefs() { | 28 base::DictionaryValue* changed_prefs() { |
29 return &changed_prefs_; | 29 return &changed_prefs_; |
30 } | 30 } |
31 | 31 |
32 bool initialization_completed() const { | 32 bool initialization_completed() const { |
33 return initialization_completed_; | 33 return initialization_completed_; |
34 } | 34 } |
35 | 35 |
36 // PrefStore::Observer implementation: | 36 // PrefStore::Observer implementation: |
37 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; | 37 virtual void OnPrefValueChanged(const std::string& key) override; |
38 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; | 38 virtual void OnInitializationCompleted(bool succeeded) override; |
39 | 39 |
40 private: | 40 private: |
41 scoped_refptr<SupervisedUserPrefStore> pref_store_; | 41 scoped_refptr<SupervisedUserPrefStore> pref_store_; |
42 base::DictionaryValue changed_prefs_; | 42 base::DictionaryValue changed_prefs_; |
43 bool initialization_completed_; | 43 bool initialization_completed_; |
44 }; | 44 }; |
45 | 45 |
46 SupervisedUserPrefStoreFixture::SupervisedUserPrefStoreFixture( | 46 SupervisedUserPrefStoreFixture::SupervisedUserPrefStoreFixture( |
47 SupervisedUserSettingsService* settings_service) | 47 SupervisedUserSettingsService* settings_service) |
48 : pref_store_(new SupervisedUserPrefStore(settings_service)), | 48 : pref_store_(new SupervisedUserPrefStore(settings_service)), |
(...skipping 16 matching lines...) Expand all Loading... |
65 EXPECT_FALSE(initialization_completed_); | 65 EXPECT_FALSE(initialization_completed_); |
66 EXPECT_TRUE(succeeded); | 66 EXPECT_TRUE(succeeded); |
67 EXPECT_TRUE(pref_store_->IsInitializationComplete()); | 67 EXPECT_TRUE(pref_store_->IsInitializationComplete()); |
68 initialization_completed_ = true; | 68 initialization_completed_ = true; |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 class SupervisedUserPrefStoreTest : public ::testing::Test { | 73 class SupervisedUserPrefStoreTest : public ::testing::Test { |
74 public: | 74 public: |
75 virtual void SetUp() OVERRIDE; | 75 virtual void SetUp() override; |
76 virtual void TearDown() OVERRIDE; | 76 virtual void TearDown() override; |
77 | 77 |
78 protected: | 78 protected: |
79 SupervisedUserSettingsService service_; | 79 SupervisedUserSettingsService service_; |
80 scoped_refptr<TestingPrefStore> pref_store_; | 80 scoped_refptr<TestingPrefStore> pref_store_; |
81 }; | 81 }; |
82 | 82 |
83 void SupervisedUserPrefStoreTest::SetUp() { | 83 void SupervisedUserPrefStoreTest::SetUp() { |
84 pref_store_ = new TestingPrefStore(); | 84 pref_store_ = new TestingPrefStore(); |
85 service_.Init(pref_store_); | 85 service_.Init(pref_store_); |
86 } | 86 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 TEST_F(SupervisedUserPrefStoreTest, CreatePrefStoreAfterInitialization) { | 163 TEST_F(SupervisedUserPrefStoreTest, CreatePrefStoreAfterInitialization) { |
164 pref_store_->SetInitializationCompleted(); | 164 pref_store_->SetInitializationCompleted(); |
165 service_.SetActive(true); | 165 service_.SetActive(true); |
166 | 166 |
167 SupervisedUserPrefStoreFixture fixture(&service_); | 167 SupervisedUserPrefStoreFixture fixture(&service_); |
168 EXPECT_TRUE(fixture.initialization_completed()); | 168 EXPECT_TRUE(fixture.initialization_completed()); |
169 EXPECT_EQ(0u, fixture.changed_prefs()->size()); | 169 EXPECT_EQ(0u, fixture.changed_prefs()->size()); |
170 } | 170 } |
171 | 171 |
OLD | NEW |