| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/storage/policy_value_store.h" | 5 #include "chrome/browser/extensions/api/storage/policy_value_store.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 new LeveldbValueStore(scoped_temp_dir_.path())))); | 101 new LeveldbValueStore(scoped_temp_dir_.path())))); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void TearDown() OVERRIDE { | 104 virtual void TearDown() OVERRIDE { |
| 105 observers_->RemoveObserver(&observer_); | 105 observers_->RemoveObserver(&observer_); |
| 106 store_.reset(); | 106 store_.reset(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 base::ScopedTempDir scoped_temp_dir_; | 110 base::ScopedTempDir scoped_temp_dir_; |
| 111 MessageLoop loop_; | 111 base::MessageLoop loop_; |
| 112 content::TestBrowserThread file_thread_; | 112 content::TestBrowserThread file_thread_; |
| 113 scoped_ptr<PolicyValueStore> store_; | 113 scoped_ptr<PolicyValueStore> store_; |
| 114 MockSettingsObserver observer_; | 114 MockSettingsObserver observer_; |
| 115 scoped_refptr<SettingsObserverList> observers_; | 115 scoped_refptr<SettingsObserverList> observers_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 TEST_F(PolicyValueStoreTest, DontProvideRecommendedPolicies) { | 118 TEST_F(PolicyValueStoreTest, DontProvideRecommendedPolicies) { |
| 119 policy::PolicyMap policies; | 119 policy::PolicyMap policies; |
| 120 base::FundamentalValue expected(123); | 120 base::FundamentalValue expected(123); |
| 121 policies.Set("must", policy::POLICY_LEVEL_MANDATORY, | 121 policies.Set("must", policy::POLICY_LEVEL_MANDATORY, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 Mock::VerifyAndClearExpectations(&observer_); | 208 Mock::VerifyAndClearExpectations(&observer_); |
| 209 | 209 |
| 210 // Don't notify when there aren't changes. | 210 // Don't notify when there aren't changes. |
| 211 EXPECT_CALL(observer_, OnSettingsChanged(_, _, _)).Times(0); | 211 EXPECT_CALL(observer_, OnSettingsChanged(_, _, _)).Times(0); |
| 212 store_->SetCurrentPolicy(policies, true); | 212 store_->SetCurrentPolicy(policies, true); |
| 213 loop_.RunUntilIdle(); | 213 loop_.RunUntilIdle(); |
| 214 Mock::VerifyAndClearExpectations(&observer_); | 214 Mock::VerifyAndClearExpectations(&observer_); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace extensions | 217 } // namespace extensions |
| OLD | NEW |