| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 if (options_.child_wait_for_parent_pipe_early) { | 338 if (options_.child_wait_for_parent_pipe_early) { |
| 339 // Tell the child to begin sending messages. | 339 // Tell the child to begin sending messages. |
| 340 char c = '\0'; | 340 char c = '\0'; |
| 341 CheckedWriteFile(WritePipeHandle(), &c, 1); | 341 CheckedWriteFile(WritePipeHandle(), &c, 1); |
| 342 } | 342 } |
| 343 | 343 |
| 344 if (options_.parent_wait_for_child_pipe) { | 344 if (options_.parent_wait_for_child_pipe) { |
| 345 // Wait until the child is done sending what it’s going to send. | 345 // Wait until the child is done sending what it’s going to send. |
| 346 char c; | 346 char c; |
| 347 CheckedReadFile(ReadPipeHandle(), &c, 1); | 347 CheckedReadFileExactly(ReadPipeHandle(), &c, 1); |
| 348 EXPECT_EQ('\0', c); | 348 EXPECT_EQ('\0', c); |
| 349 } | 349 } |
| 350 | 350 |
| 351 ASSERT_EQ(options_.expect_server_result, | 351 ASSERT_EQ(options_.expect_server_result, |
| 352 (kr = MachMessageServer::Run(this, | 352 (kr = MachMessageServer::Run(this, |
| 353 local_port, | 353 local_port, |
| 354 options_.server_options, | 354 options_.server_options, |
| 355 options_.server_persistent, | 355 options_.server_persistent, |
| 356 options_.server_receive_large, | 356 options_.server_receive_large, |
| 357 options_.server_timeout_ms))) | 357 options_.server_timeout_ms))) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // Let the child know it’s safe to exit. | 390 // Let the child know it’s safe to exit. |
| 391 char c = '\0'; | 391 char c = '\0'; |
| 392 CheckedWriteFile(WritePipeHandle(), &c, 1); | 392 CheckedWriteFile(WritePipeHandle(), &c, 1); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 void MachMultiprocessChild() override { | 396 void MachMultiprocessChild() override { |
| 397 if (options_.child_wait_for_parent_pipe_early) { | 397 if (options_.child_wait_for_parent_pipe_early) { |
| 398 // Wait until the parent is done setting things up on its end. | 398 // Wait until the parent is done setting things up on its end. |
| 399 char c; | 399 char c; |
| 400 CheckedReadFile(ReadPipeHandle(), &c, 1); | 400 CheckedReadFileExactly(ReadPipeHandle(), &c, 1); |
| 401 EXPECT_EQ('\0', c); | 401 EXPECT_EQ('\0', c); |
| 402 } | 402 } |
| 403 | 403 |
| 404 for (size_t index = 0; | 404 for (size_t index = 0; |
| 405 index < options_.client_send_request_count; | 405 index < options_.client_send_request_count; |
| 406 ++index) { | 406 ++index) { |
| 407 if (options_.child_send_all_requests_before_receiving_any_replies) { | 407 if (options_.child_send_all_requests_before_receiving_any_replies) { |
| 408 // For this test, all of the messages need to go into the queue before | 408 // For this test, all of the messages need to go into the queue before |
| 409 // the parent is allowed to start processing them. Don’t attempt to | 409 // the parent is allowed to start processing them. Don’t attempt to |
| 410 // process replies before all of the requests are sent, because the | 410 // process replies before all of the requests are sent, because the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 424 | 424 |
| 425 for (size_t index = 0; | 425 for (size_t index = 0; |
| 426 index < options_.client_send_request_count; | 426 index < options_.client_send_request_count; |
| 427 ++index) { | 427 ++index) { |
| 428 ASSERT_NO_FATAL_FAILURE(ChildWaitForReply()); | 428 ASSERT_NO_FATAL_FAILURE(ChildWaitForReply()); |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 if (options_.child_wait_for_parent_pipe_late) { | 432 if (options_.child_wait_for_parent_pipe_late) { |
| 433 char c; | 433 char c; |
| 434 CheckedReadFile(ReadPipeHandle(), &c, 1); | 434 CheckedReadFileExactly(ReadPipeHandle(), &c, 1); |
| 435 ASSERT_EQ('\0', c); | 435 ASSERT_EQ('\0', c); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 // In the child process, sends a request message to the server. | 439 // In the child process, sends a request message to the server. |
| 440 void ChildSendRequest() { | 440 void ChildSendRequest() { |
| 441 // local_receive_port_owner will the receive right that is created in this | 441 // local_receive_port_owner will the receive right that is created in this |
| 442 // scope and intended to be destroyed when leaving this scope, after it has | 442 // scope and intended to be destroyed when leaving this scope, after it has |
| 443 // been carried in a Mach message. | 443 // been carried in a Mach message. |
| 444 base::mac::ScopedMachReceiveRight local_receive_port_owner; | 444 base::mac::ScopedMachReceiveRight local_receive_port_owner; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 options.expect_server_transaction_count = 0; | 847 options.expect_server_transaction_count = 0; |
| 848 options.client_send_large = true; | 848 options.client_send_large = true; |
| 849 options.client_expect_reply = false; | 849 options.client_expect_reply = false; |
| 850 TestMachMessageServer test_mach_message_server(options); | 850 TestMachMessageServer test_mach_message_server(options); |
| 851 test_mach_message_server.Test(); | 851 test_mach_message_server.Test(); |
| 852 } | 852 } |
| 853 | 853 |
| 854 } // namespace | 854 } // namespace |
| 855 } // namespace test | 855 } // namespace test |
| 856 } // namespace crashpad | 856 } // namespace crashpad |
| OLD | NEW |