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

Side by Side Diff: components/policy/core/common/config_dir_policy_loader_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/json/json_string_value_serializer.h" 8 #include "base/json/json_string_value_serializer.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 void TestHarness::WriteConfigFile(const base::DictionaryValue& dict, 139 void TestHarness::WriteConfigFile(const base::DictionaryValue& dict,
140 const std::string& file_name) { 140 const std::string& file_name) {
141 std::string data; 141 std::string data;
142 JSONStringValueSerializer serializer(&data); 142 JSONStringValueSerializer serializer(&data);
143 serializer.Serialize(dict); 143 serializer.Serialize(dict);
144 const base::FilePath mandatory_dir(test_dir().Append(kMandatoryPath)); 144 const base::FilePath mandatory_dir(test_dir().Append(kMandatoryPath));
145 ASSERT_TRUE(base::CreateDirectory(mandatory_dir)); 145 ASSERT_TRUE(base::CreateDirectory(mandatory_dir));
146 const base::FilePath file_path(mandatory_dir.AppendASCII(file_name)); 146 const base::FilePath file_path(mandatory_dir.AppendASCII(file_name));
147 ASSERT_EQ((int) data.size(), 147 ASSERT_EQ((int) data.size(),
148 file_util::WriteFile(file_path, data.c_str(), data.size())); 148 base::WriteFile(file_path, data.c_str(), data.size()));
149 } 149 }
150 150
151 std::string TestHarness::NextConfigFileName() { 151 std::string TestHarness::NextConfigFileName() {
152 EXPECT_LE(next_policy_file_index_, 999); 152 EXPECT_LE(next_policy_file_index_, 999);
153 return std::string("policy") + base::IntToString(next_policy_file_index_++); 153 return std::string("policy") + base::IntToString(next_policy_file_index_++);
154 } 154 }
155 155
156 // static 156 // static
157 PolicyProviderTestHarness* TestHarness::Create() { 157 PolicyProviderTestHarness* TestHarness::Create() {
158 return new TestHarness(); 158 return new TestHarness();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 loop_.message_loop_proxy(), harness_.test_dir(), POLICY_SCOPE_USER); 227 loop_.message_loop_proxy(), harness_.test_dir(), POLICY_SCOPE_USER);
228 scoped_ptr<PolicyBundle> bundle(loader.Load()); 228 scoped_ptr<PolicyBundle> bundle(loader.Load());
229 ASSERT_TRUE(bundle.get()); 229 ASSERT_TRUE(bundle.get());
230 PolicyBundle expected_bundle; 230 PolicyBundle expected_bundle;
231 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 231 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
232 .LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); 232 .LoadFrom(&test_dict_foo, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER);
233 EXPECT_TRUE(bundle->Equals(expected_bundle)); 233 EXPECT_TRUE(bundle->Equals(expected_bundle));
234 } 234 }
235 235
236 } // namespace policy 236 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698