| OLD | NEW |
| 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, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 token = kCheckInToken; | 60 token = kCheckInToken; |
| 61 } | 61 } |
| 62 | 62 |
| 63 mach_msg_header_t Head; | 63 mach_msg_header_t Head; |
| 64 mach_msg_body_t msgh_body; | 64 mach_msg_body_t msgh_body; |
| 65 mach_msg_port_descriptor_t port; | 65 mach_msg_port_descriptor_t port; |
| 66 NDR_record_t NDR; | 66 NDR_record_t NDR; |
| 67 child_port_token_t token; | 67 child_port_token_t token; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 struct __attribute__((packed, aligned(4))) MIGReply { | 70 struct MIGReply : public mig_reply_error_t { |
| 71 MIGReply() { | 71 MIGReply() { |
| 72 memset(this, 0x5a, sizeof(*this)); | 72 memset(this, 0x5a, sizeof(*this)); |
| 73 RetCode = KERN_FAILURE; | 73 RetCode = KERN_FAILURE; |
| 74 } | 74 } |
| 75 | 75 |
| 76 mach_msg_header_t Head; | |
| 77 NDR_record_t NDR; | |
| 78 kern_return_t RetCode; | |
| 79 | |
| 80 void Verify() { | 76 void Verify() { |
| 81 EXPECT_EQ(implicit_cast<mach_msg_bits_t>(MACH_MSGH_BITS(0, 0)), | 77 EXPECT_EQ(implicit_cast<mach_msg_bits_t>(MACH_MSGH_BITS(0, 0)), |
| 82 Head.msgh_bits); | 78 Head.msgh_bits); |
| 83 EXPECT_EQ(sizeof(*this), Head.msgh_size); | 79 EXPECT_EQ(sizeof(*this), Head.msgh_size); |
| 84 EXPECT_EQ(kMachPortNull, Head.msgh_remote_port); | 80 EXPECT_EQ(kMachPortNull, Head.msgh_remote_port); |
| 85 EXPECT_EQ(kMachPortNull, Head.msgh_local_port); | 81 EXPECT_EQ(kMachPortNull, Head.msgh_local_port); |
| 86 EXPECT_EQ(10111, Head.msgh_id); | 82 EXPECT_EQ(10111, Head.msgh_id); |
| 87 EXPECT_EQ(0, memcmp(&NDR, &NDR_record, sizeof(NDR))); | 83 EXPECT_EQ(0, memcmp(&NDR, &NDR_record, sizeof(NDR))); |
| 88 EXPECT_EQ(MIG_NO_REPLY, RetCode); | 84 EXPECT_EQ(MIG_NO_REPLY, RetCode); |
| 89 } | 85 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 reinterpret_cast<mach_msg_header_t*>(&reply), | 120 reinterpret_cast<mach_msg_header_t*>(&reply), |
| 125 &destroy_complex_request)); | 121 &destroy_complex_request)); |
| 126 EXPECT_FALSE(destroy_complex_request); | 122 EXPECT_FALSE(destroy_complex_request); |
| 127 | 123 |
| 128 reply.Verify(); | 124 reply.Verify(); |
| 129 } | 125 } |
| 130 | 126 |
| 131 } // namespace | 127 } // namespace |
| 132 } // namespace test | 128 } // namespace test |
| 133 } // namespace crashpad | 129 } // namespace crashpad |
| OLD | NEW |