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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "util/mach/mach_message_server.h" | 15 #include "util/mach/mach_message_server.h" |
16 | 16 |
17 #include <mach/mach.h> | 17 #include <mach/mach.h> |
18 #include <string.h> | 18 #include <string.h> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/mac/scoped_mach_port.h" | 21 #include "base/mac/scoped_mach_port.h" |
22 #include "gtest/gtest.h" | 22 #include "gtest/gtest.h" |
23 #include "util/file/fd_io.h" | 23 #include "util/file/fd_io.h" |
24 #include "util/mach/mach_extensions.h" | 24 #include "util/mach/mach_extensions.h" |
25 #include "util/test/mac/mach_errors.h" | 25 #include "util/test/mac/mach_errors.h" |
26 #include "util/test/mac/mach_multiprocess.h" | 26 #include "util/test/mac/mach_multiprocess.h" |
27 | 27 |
| 28 namespace crashpad { |
| 29 namespace test { |
28 namespace { | 30 namespace { |
29 | 31 |
30 using namespace crashpad; | |
31 using namespace crashpad::test; | |
32 | |
33 class TestMachMessageServer : public MachMessageServer::Interface, | 32 class TestMachMessageServer : public MachMessageServer::Interface, |
34 public MachMultiprocess { | 33 public MachMultiprocess { |
35 public: | 34 public: |
36 struct Options { | 35 struct Options { |
37 // The type of reply port that the client should put in its request message. | 36 // The type of reply port that the client should put in its request message. |
38 enum ReplyPortType { | 37 enum ReplyPortType { |
39 // The normal reply port is the client’s local port, to which it holds | 38 // The normal reply port is the client’s local port, to which it holds |
40 // a receive right. This allows the server to respond directly to the | 39 // a receive right. This allows the server to respond directly to the |
41 // client. The client will expect a reply. | 40 // client. The client will expect a reply. |
42 kReplyPortNormal, | 41 kReplyPortNormal, |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 // so a new buffer is allocated to receive the message. The server receives | 837 // so a new buffer is allocated to receive the message. The server receives |
839 // the large request message, processes it, and returns a reply to the client. | 838 // the large request message, processes it, and returns a reply to the client. |
840 TestMachMessageServer::Options options; | 839 TestMachMessageServer::Options options; |
841 options.server_options = MACH_RCV_LARGE; | 840 options.server_options = MACH_RCV_LARGE; |
842 options.client_send_large = true; | 841 options.client_send_large = true; |
843 TestMachMessageServer test_mach_message_server(options); | 842 TestMachMessageServer test_mach_message_server(options); |
844 test_mach_message_server.Test(); | 843 test_mach_message_server.Test(); |
845 } | 844 } |
846 | 845 |
847 } // namespace | 846 } // namespace |
| 847 } // namespace test |
| 848 } // namespace crashpad |
OLD | NEW |