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

Unified Diff: util/mach/mach_message_server_test.cc

Issue 809103002: Add NewMachPort() and its test, and switch call sites to use it (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/mach/mach_extensions_test.cc ('k') | util/mach/notify_server_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/mach_message_server_test.cc
diff --git a/util/mach/mach_message_server_test.cc b/util/mach/mach_message_server_test.cc
index 5a889427729b896838f469f5b0aa54d3182a274d..cc2e639e50301b33e3e66cb4e85658119d55609c 100644
--- a/util/mach/mach_message_server_test.cc
+++ b/util/mach/mach_message_server_test.cc
@@ -465,12 +465,9 @@ class TestMachMessageServer : public MachMessageServer::Interface,
// method returns. A send right will be made from this receive right and
// carried in the request message to the server. By the time the server
// looks at the right, it will have become a dead name.
- kr = mach_port_allocate(mach_task_self(),
- MACH_PORT_RIGHT_RECEIVE,
- &request.header.msgh_local_port);
- ASSERT_EQ(KERN_SUCCESS, kr)
- << MachErrorMessage(kr, "mach_port_allocate");
- local_receive_port_owner.reset(request.header.msgh_local_port);
+ local_receive_port_owner.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE));
+ ASSERT_NE(kMachPortNull, local_receive_port_owner);
+ request.header.msgh_local_port = local_receive_port_owner;
break;
}
}
@@ -480,12 +477,9 @@ class TestMachMessageServer : public MachMessageServer::Interface,
// will appear in the parent process. This is used to test that the server
// properly handles ownership of resources received in complex messages.
request.body.msgh_descriptor_count = 1;
- kr = mach_port_allocate(mach_task_self(),
- MACH_PORT_RIGHT_RECEIVE,
- &request.port_descriptor.name);
- ASSERT_EQ(KERN_SUCCESS, kr)
- << MachErrorMessage(kr, "mach_port_allocate");
- child_complex_message_port_.reset(request.port_descriptor.name);
+ child_complex_message_port_.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE));
+ ASSERT_NE(kMachPortNull, child_complex_message_port_);
+ request.port_descriptor.name = child_complex_message_port_;
request.port_descriptor.disposition = MACH_MSG_TYPE_MAKE_SEND;
request.port_descriptor.type = MACH_MSG_PORT_DESCRIPTOR;
} else {
« no previous file with comments | « util/mach/mach_extensions_test.cc ('k') | util/mach/notify_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698