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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_browsertest.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/callback.h" 5 #include "base/callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return profile_connector->policy_service(); 239 return profile_connector->policy_service();
240 } 240 }
241 241
242 invalidation::FakeInvalidationService* GetInvalidationService() { 242 invalidation::FakeInvalidationService* GetInvalidationService() {
243 return static_cast<invalidation::FakeInvalidationService*>( 243 return static_cast<invalidation::FakeInvalidationService*>(
244 invalidation::InvalidationServiceFactory::GetForProfile( 244 invalidation::InvalidationServiceFactory::GetForProfile(
245 browser()->profile())); 245 browser()->profile()));
246 } 246 }
247 247
248 void SetServerPolicy(const std::string& policy) { 248 void SetServerPolicy(const std::string& policy) {
249 int result = file_util::WriteFile(policy_file_path(), policy.data(), 249 int result = base::WriteFile(policy_file_path(), policy.data(),
250 policy.size()); 250 policy.size());
251 ASSERT_EQ(static_cast<int>(policy.size()), result); 251 ASSERT_EQ(static_cast<int>(policy.size()), result);
252 } 252 }
253 253
254 base::FilePath policy_file_path() const { 254 base::FilePath policy_file_path() const {
255 return temp_dir_.path().AppendASCII("policy.json"); 255 return temp_dir_.path().AppendASCII("policy.json");
256 } 256 }
257 257
258 virtual void OnPolicyUpdated(const PolicyNamespace& ns, 258 virtual void OnPolicyUpdated(const PolicyNamespace& ns,
259 const PolicyMap& previous, 259 const PolicyMap& previous,
260 const PolicyMap& current) OVERRIDE { 260 const PolicyMap& current) OVERRIDE {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 // They should now serialize to the same bytes. 426 // They should now serialize to the same bytes.
427 std::string chrome_settings_serialized; 427 std::string chrome_settings_serialized;
428 std::string cloud_policy_serialized; 428 std::string cloud_policy_serialized;
429 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); 429 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized));
430 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); 430 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized));
431 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); 431 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized);
432 } 432 }
433 433
434 } // namespace policy 434 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/parsers/metadata_parser_filebase_unittest.cc ('k') | chrome/browser/policy/test/local_policy_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698