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

Unified Diff: util/mach/child_port_server_test.cc

Issue 755313004: Pass Mach message trailers to server handler functions (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/child_port_server.cc ('k') | util/mach/exc_client_variants_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/child_port_server_test.cc
diff --git a/util/mach/child_port_server_test.cc b/util/mach/child_port_server_test.cc
index ff9d83dde3f5637c66715d1d187d316550e4d35c..ddc525bad9fd8929246996dca3c11b5d994e2450 100644
--- a/util/mach/child_port_server_test.cc
+++ b/util/mach/child_port_server_test.cc
@@ -48,7 +48,7 @@ struct __attribute__((packed, aligned(4))) ChildPortCheckInRequest {
memset(this, 0xa5, sizeof(*this));
Head.msgh_bits =
MACH_MSGH_BITS(0, MACH_MSG_TYPE_PORT_SEND) | MACH_MSGH_BITS_COMPLEX;
- Head.msgh_size = sizeof(*this);
+ Head.msgh_size = sizeof(*this) - sizeof(trailer);
Head.msgh_remote_port = MACH_PORT_NULL;
Head.msgh_local_port = kServerLocalPort;
Head.msgh_id = 10011;
@@ -65,6 +65,7 @@ struct __attribute__((packed, aligned(4))) ChildPortCheckInRequest {
mach_msg_port_descriptor_t port;
NDR_record_t NDR;
child_port_token_t token;
+ mach_msg_trailer_t trailer;
};
struct MIGReply : public mig_reply_error_t {
@@ -87,11 +88,12 @@ struct MIGReply : public mig_reply_error_t {
class MockChildPortServerInterface : public ChildPortServer::Interface {
public:
- MOCK_METHOD5(HandleChildPortCheckIn,
+ MOCK_METHOD6(HandleChildPortCheckIn,
kern_return_t(child_port_server_t server,
const child_port_token_t token,
mach_port_t port,
mach_msg_type_name_t right_type,
+ const mach_msg_trailer_t* trailer,
bool* destroy_complex_request));
};
@@ -100,7 +102,7 @@ TEST(ChildPortServer, MockChildPortCheckIn) {
ChildPortServer server(&server_interface);
ChildPortCheckInRequest request;
- EXPECT_LE(sizeof(request), server.MachMessageServerRequestSize());
+ EXPECT_LE(request.Head.msgh_size, server.MachMessageServerRequestSize());
MIGReply reply;
EXPECT_LE(sizeof(reply), server.MachMessageServerReplySize());
@@ -110,6 +112,7 @@ TEST(ChildPortServer, MockChildPortCheckIn) {
kCheckInToken,
kCheckInPort,
kCheckInPortRightType,
+ Eq(&request.trailer),
Pointee(Eq(false))))
.WillOnce(Return(MIG_NO_REPLY))
.RetiresOnSaturation();
« no previous file with comments | « util/mach/child_port_server.cc ('k') | util/mach/exc_client_variants_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698