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

Side by Side Diff: chrome/browser/extensions/api/storage/policy_value_store_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (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 (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 <memory> 7 #include <memory>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 base::ScopedTempDir scoped_temp_dir_; 116 base::ScopedTempDir scoped_temp_dir_;
117 base::MessageLoop loop_; 117 base::MessageLoop loop_;
118 content::TestBrowserThread file_thread_; 118 content::TestBrowserThread file_thread_;
119 std::unique_ptr<PolicyValueStore> store_; 119 std::unique_ptr<PolicyValueStore> store_;
120 MockSettingsObserver observer_; 120 MockSettingsObserver observer_;
121 scoped_refptr<SettingsObserverList> observers_; 121 scoped_refptr<SettingsObserverList> observers_;
122 }; 122 };
123 123
124 TEST_F(PolicyValueStoreTest, DontProvideRecommendedPolicies) { 124 TEST_F(PolicyValueStoreTest, DontProvideRecommendedPolicies) {
125 policy::PolicyMap policies; 125 policy::PolicyMap policies;
126 base::FundamentalValue expected(123); 126 base::Value expected(123);
127 policies.Set("must", policy::POLICY_LEVEL_MANDATORY, 127 policies.Set("must", policy::POLICY_LEVEL_MANDATORY,
128 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 128 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
129 expected.CreateDeepCopy(), nullptr); 129 expected.CreateDeepCopy(), nullptr);
130 policies.Set("may", policy::POLICY_LEVEL_RECOMMENDED, 130 policies.Set("may", policy::POLICY_LEVEL_RECOMMENDED,
131 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 131 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
132 base::MakeUnique<base::FundamentalValue>(456), nullptr); 132 base::MakeUnique<base::Value>(456), nullptr);
133 store_->SetCurrentPolicy(policies); 133 store_->SetCurrentPolicy(policies);
134 ValueStore::ReadResult result = store_->Get(); 134 ValueStore::ReadResult result = store_->Get();
135 ASSERT_TRUE(result->status().ok()); 135 ASSERT_TRUE(result->status().ok());
136 EXPECT_EQ(1u, result->settings().size()); 136 EXPECT_EQ(1u, result->settings().size());
137 base::Value* value = NULL; 137 base::Value* value = NULL;
138 EXPECT_FALSE(result->settings().Get("may", &value)); 138 EXPECT_FALSE(result->settings().Get("may", &value));
139 EXPECT_TRUE(result->settings().Get("must", &value)); 139 EXPECT_TRUE(result->settings().Get("must", &value));
140 EXPECT_TRUE(base::Value::Equals(&expected, value)); 140 EXPECT_TRUE(base::Value::Equals(&expected, value));
141 } 141 }
142 142
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 Mock::VerifyAndClearExpectations(&observer_); 228 Mock::VerifyAndClearExpectations(&observer_);
229 229
230 // Don't notify when there aren't any changes. 230 // Don't notify when there aren't any changes.
231 EXPECT_CALL(observer_, OnSettingsChanged(_, _, _)).Times(0); 231 EXPECT_CALL(observer_, OnSettingsChanged(_, _, _)).Times(0);
232 store_->SetCurrentPolicy(policies); 232 store_->SetCurrentPolicy(policies);
233 base::RunLoop().RunUntilIdle(); 233 base::RunLoop().RunUntilIdle();
234 Mock::VerifyAndClearExpectations(&observer_); 234 Mock::VerifyAndClearExpectations(&observer_);
235 } 235 }
236 236
237 } // namespace extensions 237 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698