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

Side by Side Diff: chrome/common/mac/mock_launchd.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 "chrome/common/mac/mock_launchd.h" 5 #include "chrome/common/mac/mock_launchd.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/un.h> 9 #include <sys/un.h>
10 10
(...skipping 24 matching lines...) Expand all
35 base::FilePath contents = bundle_root->AppendASCII("Contents"); 35 base::FilePath contents = bundle_root->AppendASCII("Contents");
36 base::FilePath mac_os = contents.AppendASCII("MacOS"); 36 base::FilePath mac_os = contents.AppendASCII("MacOS");
37 *executable = mac_os.Append(name); 37 *executable = mac_os.Append(name);
38 base::FilePath info_plist = contents.Append("Info.plist"); 38 base::FilePath info_plist = contents.Append("Info.plist");
39 39
40 if (!base::CreateDirectory(mac_os)) { 40 if (!base::CreateDirectory(mac_os)) {
41 return false; 41 return false;
42 } 42 }
43 const char *data = "#! testbundle\n"; 43 const char *data = "#! testbundle\n";
44 int len = strlen(data); 44 int len = strlen(data);
45 if (file_util::WriteFile(*executable, data, len) != len) { 45 if (base::WriteFile(*executable, data, len) != len) {
46 return false; 46 return false;
47 } 47 }
48 if (chmod(executable->value().c_str(), 0555) != 0) { 48 if (chmod(executable->value().c_str(), 0555) != 0) {
49 return false; 49 return false;
50 } 50 }
51 51
52 chrome::VersionInfo version_info; 52 chrome::VersionInfo version_info;
53 53
54 const char* info_plist_format = 54 const char* info_plist_format =
55 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 55 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
(...skipping 14 matching lines...) Expand all
70 " <key>CFBundleVersion</key>\n" 70 " <key>CFBundleVersion</key>\n"
71 " <string>1</string>\n" 71 " <string>1</string>\n"
72 "</dict>\n" 72 "</dict>\n"
73 "</plist>\n"; 73 "</plist>\n";
74 std::string info_plist_data = 74 std::string info_plist_data =
75 base::StringPrintf(info_plist_format, 75 base::StringPrintf(info_plist_format,
76 name.c_str(), 76 name.c_str(),
77 name.c_str(), 77 name.c_str(),
78 version_info.Version().c_str()); 78 version_info.Version().c_str());
79 len = info_plist_data.length(); 79 len = info_plist_data.length();
80 if (file_util::WriteFile(info_plist, info_plist_data.c_str(), len) != len) { 80 if (base::WriteFile(info_plist, info_plist_data.c_str(), len) != len) {
81 return false; 81 return false;
82 } 82 }
83 const UInt8* bundle_root_path = 83 const UInt8* bundle_root_path =
84 reinterpret_cast<const UInt8*>(bundle_root->value().c_str()); 84 reinterpret_cast<const UInt8*>(bundle_root->value().c_str());
85 base::ScopedCFTypeRef<CFURLRef> url( 85 base::ScopedCFTypeRef<CFURLRef> url(
86 CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, 86 CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
87 bundle_root_path, 87 bundle_root_path,
88 bundle_root->value().length(), 88 bundle_root->value().length(),
89 true)); 89 true));
90 base::ScopedCFTypeRef<CFBundleRef> bundle( 90 base::ScopedCFTypeRef<CFBundleRef> bundle(
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 Type type, 285 Type type,
286 CFStringRef name) { 286 CFStringRef name) {
287 delete_called_ = true; 287 delete_called_ = true;
288 return true; 288 return true;
289 } 289 }
290 290
291 void MockLaunchd::SignalReady() { 291 void MockLaunchd::SignalReady() {
292 ASSERT_TRUE(as_service_); 292 ASSERT_TRUE(as_service_);
293 running_lock_.reset(TakeNamedLock(pipe_name_, true)); 293 running_lock_.reset(TakeNamedLock(pipe_name_, true));
294 } 294 }
OLDNEW
« no previous file with comments | « chrome/common/importer/firefox_importer_utils_unittest.cc ('k') | chrome/common/media_galleries/picasa_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698