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

Side by Side Diff: util/test/mac/mach_multiprocess.cc

Issue 575823002: Drop 10.5 support (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « util/mach/mach_extensions.cc ('k') | util/util.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/test/mac/mach_multiprocess.h" 15 #include "util/test/mac/mach_multiprocess.h"
16 16
17 #include <AvailabilityMacros.h> 17 #include <AvailabilityMacros.h>
18 #include <bsm/libbsm.h> 18 #include <bsm/libbsm.h>
19 #include <servers/bootstrap.h> 19 #include <servers/bootstrap.h>
20 20
21 #include <string> 21 #include <string>
22 22
23 #include "base/auto_reset.h" 23 #include "base/auto_reset.h"
24 #include "base/logging.h" 24 #include "base/logging.h"
25 #include "base/mac/scoped_mach_port.h" 25 #include "base/mac/scoped_mach_port.h"
26 #include "base/memory/scoped_ptr.h" 26 #include "base/memory/scoped_ptr.h"
27 #include "base/rand_util.h" 27 #include "base/rand_util.h"
28 #include "gtest/gtest.h" 28 #include "gtest/gtest.h"
29 #include "util/mach/bootstrap.h"
30 #include "util/mach/mach_extensions.h" 29 #include "util/mach/mach_extensions.h"
31 #include "util/misc/scoped_forbid_return.h" 30 #include "util/misc/scoped_forbid_return.h"
32 #include "util/test/errors.h" 31 #include "util/test/errors.h"
33 #include "util/test/mac/mach_errors.h" 32 #include "util/test/mac/mach_errors.h"
34 33
35 namespace { 34 namespace {
36 35
37 // The “hello” message contains a send right to the child process’ task port. 36 // The “hello” message contains a send right to the child process’ task port.
38 struct SendHelloMessage : public mach_msg_base_t { 37 struct SendHelloMessage : public mach_msg_base_t {
39 mach_msg_port_descriptor_t port_descriptor; 38 mach_msg_port_descriptor_t port_descriptor;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 90
92 // Set up the parent port and register it with the bootstrap server before 91 // Set up the parent port and register it with the bootstrap server before
93 // forking, so that it’s guaranteed to be there when the child attempts to 92 // forking, so that it’s guaranteed to be there when the child attempts to
94 // look it up. 93 // look it up.
95 info_->service_name = "com.googlecode.crashpad.test.mach_multiprocess."; 94 info_->service_name = "com.googlecode.crashpad.test.mach_multiprocess.";
96 for (int index = 0; index < 16; ++index) { 95 for (int index = 0; index < 16; ++index) {
97 info_->service_name.append(1, base::RandInt('A', 'Z')); 96 info_->service_name.append(1, base::RandInt('A', 'Z'));
98 } 97 }
99 98
100 mach_port_t local_port; 99 mach_port_t local_port;
101 kern_return_t kr = 100 kern_return_t kr = bootstrap_check_in(bootstrap_port,
102 BootstrapCheckIn(bootstrap_port, info_->service_name, &local_port); 101 info_->service_name.c_str(),
102 &local_port);
103 ASSERT_EQ(BOOTSTRAP_SUCCESS, kr) 103 ASSERT_EQ(BOOTSTRAP_SUCCESS, kr)
104 << BootstrapErrorMessage(kr, "bootstrap_check_in"); 104 << BootstrapErrorMessage(kr, "bootstrap_check_in");
105 info_->local_port.reset(local_port); 105 info_->local_port.reset(local_port);
106 } 106 }
107 107
108 mach_port_t MachMultiprocess::LocalPort() const { 108 mach_port_t MachMultiprocess::LocalPort() const {
109 EXPECT_NE(kMachPortNull, info_->local_port); 109 EXPECT_NE(kMachPortNull, info_->local_port);
110 return info_->local_port; 110 return info_->local_port;
111 } 111 }
112 112
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (Test::HasFailure()) { 264 if (Test::HasFailure()) {
265 // Trigger the ScopedForbidReturn destructor. 265 // Trigger the ScopedForbidReturn destructor.
266 return; 266 return;
267 } 267 }
268 268
269 forbid_return.Disarm(); 269 forbid_return.Disarm();
270 } 270 }
271 271
272 } // namespace test 272 } // namespace test
273 } // namespace crashpad 273 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/mach_extensions.cc ('k') | util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698