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

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

Issue 700383007: Use implicit_cast<> instead of static_cast<> whenever possible (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 1 month 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 ASSERT_EQ(MACH_MSG_SUCCESS, kr) << MachErrorMessage(kr, "mach_msg"); 132 ASSERT_EQ(MACH_MSG_SUCCESS, kr) << MachErrorMessage(kr, "mach_msg");
133 133
134 // Comb through the entire message, checking every field against its expected 134 // Comb through the entire message, checking every field against its expected
135 // value. 135 // value.
136 EXPECT_EQ(MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND, MACH_MSG_TYPE_MOVE_SEND) | 136 EXPECT_EQ(MACH_MSGH_BITS(MACH_MSG_TYPE_MOVE_SEND, MACH_MSG_TYPE_MOVE_SEND) |
137 MACH_MSGH_BITS_COMPLEX, 137 MACH_MSGH_BITS_COMPLEX,
138 message.header.msgh_bits); 138 message.header.msgh_bits);
139 ASSERT_EQ(sizeof(SendHelloMessage), message.header.msgh_size); 139 ASSERT_EQ(sizeof(SendHelloMessage), message.header.msgh_size);
140 EXPECT_EQ(info_->local_port, message.header.msgh_local_port); 140 EXPECT_EQ(info_->local_port, message.header.msgh_local_port);
141 ASSERT_EQ(1u, message.body.msgh_descriptor_count); 141 ASSERT_EQ(1u, message.body.msgh_descriptor_count);
142 EXPECT_EQ(static_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_MOVE_SEND), 142 EXPECT_EQ(implicit_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_MOVE_SEND),
143 message.port_descriptor.disposition); 143 message.port_descriptor.disposition);
144 ASSERT_EQ(static_cast<mach_msg_descriptor_type_t>(MACH_MSG_PORT_DESCRIPTOR), 144 ASSERT_EQ(implicit_cast<mach_msg_descriptor_type_t>(MACH_MSG_PORT_DESCRIPTOR),
145 message.port_descriptor.type); 145 message.port_descriptor.type);
146 ASSERT_EQ(static_cast<mach_msg_trailer_type_t>(MACH_MSG_TRAILER_FORMAT_0), 146 ASSERT_EQ(implicit_cast<mach_msg_trailer_type_t>(MACH_MSG_TRAILER_FORMAT_0),
147 message.audit_trailer.msgh_trailer_type); 147 message.audit_trailer.msgh_trailer_type);
148 ASSERT_EQ(sizeof(message.audit_trailer), 148 ASSERT_EQ(sizeof(message.audit_trailer),
149 message.audit_trailer.msgh_trailer_size); 149 message.audit_trailer.msgh_trailer_size);
150 EXPECT_EQ(0u, message.audit_trailer.msgh_seqno); 150 EXPECT_EQ(0u, message.audit_trailer.msgh_seqno);
151 151
152 // Check the audit trailer’s values for sanity. This is a little bit of 152 // Check the audit trailer’s values for sanity. This is a little bit of
153 // overkill, but because the service was registered with the bootstrap server 153 // overkill, but because the service was registered with the bootstrap server
154 // and other processes will be able to look it up and send messages to it, 154 // and other processes will be able to look it up and send messages to it,
155 // these checks disambiguate genuine failures later on in the test from those 155 // these checks disambiguate genuine failures later on in the test from those
156 // that would occur if an errant process sends a message to this service. 156 // that would occur if an errant process sends a message to this service.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (testing::Test::HasFailure()) { 270 if (testing::Test::HasFailure()) {
271 // Trigger the ScopedForbidReturn destructor. 271 // Trigger the ScopedForbidReturn destructor.
272 return; 272 return;
273 } 273 }
274 274
275 forbid_return.Disarm(); 275 forbid_return.Disarm();
276 } 276 }
277 277
278 } // namespace test 278 } // namespace test
279 } // namespace crashpad 279 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698