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

Side by Side Diff: util/mach/child_port_server_test.cc

Issue 757113002: ExcServerVariants test: use constructors to initialize test structures (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | util/mach/exc_server_variants_test.cc » ('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,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « no previous file | util/mach/exc_server_variants_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698