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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 MockLaunchd::MockLaunchd(const FilePath& file, MessageLoop* loop, | 96 MockLaunchd::MockLaunchd(const FilePath& file, MessageLoop* loop, |
97 bool create_socket, bool as_service) | 97 bool create_socket, bool as_service) |
98 : file_(file), | 98 : file_(file), |
99 message_loop_(loop), | 99 message_loop_(loop), |
100 create_socket_(create_socket), | 100 create_socket_(create_socket), |
101 as_service_(as_service), | 101 as_service_(as_service), |
102 restart_called_(false), | 102 restart_called_(false), |
103 remove_called_(false), | 103 remove_called_(false), |
104 job_called_(false), | |
105 checkin_called_(false), | 104 checkin_called_(false), |
106 write_called_(false), | 105 write_called_(false), |
107 delete_called_(false) { | 106 delete_called_(false) { |
108 std::string pipe_suffix("_SOCKET"); | 107 std::string pipe_suffix("_SOCKET"); |
109 FilePath socket_path = file_; | 108 FilePath socket_path = file_; |
110 while (socket_path.value().length() + pipe_suffix.length() > | 109 while (socket_path.value().length() + pipe_suffix.length() > |
111 kMaxPipeNameLength - 2) { | 110 kMaxPipeNameLength - 2) { |
112 socket_path = socket_path.DirName(); | 111 socket_path = socket_path.DirName(); |
113 } | 112 } |
114 pipe_name_ = socket_path.value() + pipe_suffix; | 113 pipe_name_ = socket_path.value() + pipe_suffix; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 Type type, | 292 Type type, |
294 CFStringRef name) { | 293 CFStringRef name) { |
295 delete_called_ = true; | 294 delete_called_ = true; |
296 return true; | 295 return true; |
297 } | 296 } |
298 | 297 |
299 void MockLaunchd::SignalReady() { | 298 void MockLaunchd::SignalReady() { |
300 ASSERT_TRUE(as_service_); | 299 ASSERT_TRUE(as_service_); |
301 running_lock_.reset(TakeNamedLock(pipe_name_, true)); | 300 running_lock_.reset(TakeNamedLock(pipe_name_, true)); |
302 } | 301 } |
OLD | NEW |