| 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/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 19 matching lines...) Expand all Loading... |
| 30 bool MockLaunchd::MakeABundle(const base::FilePath& dst, | 30 bool MockLaunchd::MakeABundle(const base::FilePath& dst, |
| 31 const std::string& name, | 31 const std::string& name, |
| 32 base::FilePath* bundle_root, | 32 base::FilePath* bundle_root, |
| 33 base::FilePath* executable) { | 33 base::FilePath* executable) { |
| 34 *bundle_root = dst.Append(name + std::string(".app")); | 34 *bundle_root = dst.Append(name + std::string(".app")); |
| 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 (!file_util::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 (file_util::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 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |