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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 break; | 460 break; |
461 case Options::kReplyPortNull: | 461 case Options::kReplyPortNull: |
462 request.header.msgh_local_port = MACH_PORT_NULL; | 462 request.header.msgh_local_port = MACH_PORT_NULL; |
463 break; | 463 break; |
464 case Options::kReplyPortDead: { | 464 case Options::kReplyPortDead: { |
465 // Use a newly-allocated receive right that will be destroyed when this | 465 // Use a newly-allocated receive right that will be destroyed when this |
466 // method returns. A send right will be made from this receive right and | 466 // method returns. A send right will be made from this receive right and |
467 // carried in the request message to the server. By the time the server | 467 // carried in the request message to the server. By the time the server |
468 // looks at the right, it will have become a dead name. | 468 // looks at the right, it will have become a dead name. |
469 local_receive_port_owner.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); | 469 local_receive_port_owner.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); |
470 ASSERT_NE(kMachPortNull, local_receive_port_owner); | 470 ASSERT_TRUE(local_receive_port_owner.is_valid()); |
471 request.header.msgh_local_port = local_receive_port_owner; | 471 request.header.msgh_local_port = local_receive_port_owner.get(); |
472 break; | 472 break; |
473 } | 473 } |
474 } | 474 } |
475 request.header.msgh_id = kRequestMessageID; | 475 request.header.msgh_id = kRequestMessageID; |
476 if (options_.client_send_complex) { | 476 if (options_.client_send_complex) { |
477 // Allocate a new receive right in this process and make a send right that | 477 // Allocate a new receive right in this process and make a send right that |
478 // will appear in the parent process. This is used to test that the server | 478 // will appear in the parent process. This is used to test that the server |
479 // properly handles ownership of resources received in complex messages. | 479 // properly handles ownership of resources received in complex messages. |
480 request.body.msgh_descriptor_count = 1; | 480 request.body.msgh_descriptor_count = 1; |
481 child_complex_message_port_.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); | 481 child_complex_message_port_.reset(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); |
482 ASSERT_NE(kMachPortNull, child_complex_message_port_); | 482 ASSERT_TRUE(child_complex_message_port_.is_valid()); |
483 request.port_descriptor.name = child_complex_message_port_; | 483 request.port_descriptor.name = child_complex_message_port_.get(); |
484 request.port_descriptor.disposition = MACH_MSG_TYPE_MAKE_SEND; | 484 request.port_descriptor.disposition = MACH_MSG_TYPE_MAKE_SEND; |
485 request.port_descriptor.type = MACH_MSG_PORT_DESCRIPTOR; | 485 request.port_descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
486 } else { | 486 } else { |
487 request.body.msgh_descriptor_count = 0; | 487 request.body.msgh_descriptor_count = 0; |
488 request.port_descriptor.name = MACH_PORT_NULL; | 488 request.port_descriptor.name = MACH_PORT_NULL; |
489 request.port_descriptor.disposition = 0; | 489 request.port_descriptor.disposition = 0; |
490 request.port_descriptor.type = 0; | 490 request.port_descriptor.type = 0; |
491 } | 491 } |
492 request.ndr = NDR_record; | 492 request.ndr = NDR_record; |
493 request.number = requests_++; | 493 request.number = requests_++; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 options.expect_server_transaction_count = 0; | 845 options.expect_server_transaction_count = 0; |
846 options.client_send_large = true; | 846 options.client_send_large = true; |
847 options.client_expect_reply = false; | 847 options.client_expect_reply = false; |
848 TestMachMessageServer test_mach_message_server(options); | 848 TestMachMessageServer test_mach_message_server(options); |
849 test_mach_message_server.Test(); | 849 test_mach_message_server.Test(); |
850 } | 850 } |
851 | 851 |
852 } // namespace | 852 } // namespace |
853 } // namespace test | 853 } // namespace test |
854 } // namespace crashpad | 854 } // namespace crashpad |
OLD | NEW |