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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 signature.protocolFamily = PF_UNIX; | 207 signature.protocolFamily = PF_UNIX; |
208 signature.socketType = SOCK_STREAM; | 208 signature.socketType = SOCK_STREAM; |
209 signature.protocol = 0; | 209 signature.protocol = 0; |
210 size_t unix_addr_len = offsetof(struct sockaddr_un, | 210 size_t unix_addr_len = offsetof(struct sockaddr_un, |
211 sun_path) + path_len + 1; | 211 sun_path) + path_len + 1; |
212 base::mac::ScopedCFTypeRef<CFDataRef> address( | 212 base::mac::ScopedCFTypeRef<CFDataRef> address( |
213 CFDataCreate(NULL, reinterpret_cast<UInt8*>(&unix_addr), unix_addr_len)); | 213 CFDataCreate(NULL, reinterpret_cast<UInt8*>(&unix_addr), unix_addr_len)); |
214 signature.address = address; | 214 signature.address = address; |
215 | 215 |
216 CFSocketRef socket = | 216 CFSocketRef socket = |
217 CFSocketCreateWithSocketSignature(NULL, &signature, NULL, NULL, NULL); | 217 CFSocketCreateWithSocketSignature(NULL, &signature, 0, NULL, NULL); |
218 | 218 |
219 local_pipe = CFSocketGetNative(socket); | 219 local_pipe = CFSocketGetNative(socket); |
220 EXPECT_NE(-1, local_pipe); | 220 EXPECT_NE(-1, local_pipe); |
221 if (local_pipe == -1) { | 221 if (local_pipe == -1) { |
222 if (error) { | 222 if (error) { |
223 *error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, | 223 *error = CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainPOSIX, |
224 errno, NULL); | 224 errno, NULL); |
225 } | 225 } |
226 return NULL; | 226 return NULL; |
227 } | 227 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 Type type, | 293 Type type, |
294 CFStringRef name) { | 294 CFStringRef name) { |
295 delete_called_ = true; | 295 delete_called_ = true; |
296 return true; | 296 return true; |
297 } | 297 } |
298 | 298 |
299 void MockLaunchd::SignalReady() { | 299 void MockLaunchd::SignalReady() { |
300 ASSERT_TRUE(as_service_); | 300 ASSERT_TRUE(as_service_); |
301 running_lock_.reset(TakeNamedLock(pipe_name_, true)); | 301 running_lock_.reset(TakeNamedLock(pipe_name_, true)); |
302 } | 302 } |
OLD | NEW |