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 16 matching lines...) Expand all Loading... |
27 TEST(MachExtensions, MachThreadSelf) { | 27 TEST(MachExtensions, MachThreadSelf) { |
28 base::mac::ScopedMachSendRight thread_self(mach_thread_self()); | 28 base::mac::ScopedMachSendRight thread_self(mach_thread_self()); |
29 EXPECT_EQ(thread_self, MachThreadSelf()); | 29 EXPECT_EQ(thread_self, MachThreadSelf()); |
30 } | 30 } |
31 | 31 |
32 TEST(MachExtensions, NewMachPort_Receive) { | 32 TEST(MachExtensions, NewMachPort_Receive) { |
33 base::mac::ScopedMachReceiveRight port(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); | 33 base::mac::ScopedMachReceiveRight port(NewMachPort(MACH_PORT_RIGHT_RECEIVE)); |
34 ASSERT_NE(kMachPortNull, port); | 34 ASSERT_NE(kMachPortNull, port); |
35 | 35 |
36 mach_port_type_t type; | 36 mach_port_type_t type; |
37 kern_return_t kr = mach_port_type(mach_task_self(), port, &type); | 37 kern_return_t kr = mach_port_type(mach_task_self(), port.get(), &type); |
38 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); | 38 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); |
39 | 39 |
40 EXPECT_EQ(MACH_PORT_TYPE_RECEIVE, type); | 40 EXPECT_EQ(MACH_PORT_TYPE_RECEIVE, type); |
41 } | 41 } |
42 | 42 |
43 TEST(MachExtensions, NewMachPort_PortSet) { | 43 TEST(MachExtensions, NewMachPort_PortSet) { |
44 base::mac::ScopedMachPortSet port(NewMachPort(MACH_PORT_RIGHT_PORT_SET)); | 44 base::mac::ScopedMachPortSet port(NewMachPort(MACH_PORT_RIGHT_PORT_SET)); |
45 ASSERT_NE(kMachPortNull, port); | 45 ASSERT_NE(kMachPortNull, port); |
46 | 46 |
47 mach_port_type_t type; | 47 mach_port_type_t type; |
48 kern_return_t kr = mach_port_type(mach_task_self(), port, &type); | 48 kern_return_t kr = mach_port_type(mach_task_self(), port.get(), &type); |
49 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); | 49 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); |
50 | 50 |
51 EXPECT_EQ(MACH_PORT_TYPE_PORT_SET, type); | 51 EXPECT_EQ(MACH_PORT_TYPE_PORT_SET, type); |
52 } | 52 } |
53 | 53 |
54 TEST(MachExtensions, NewMachPort_DeadName) { | 54 TEST(MachExtensions, NewMachPort_DeadName) { |
55 base::mac::ScopedMachSendRight port(NewMachPort(MACH_PORT_RIGHT_DEAD_NAME)); | 55 base::mac::ScopedMachSendRight port(NewMachPort(MACH_PORT_RIGHT_DEAD_NAME)); |
56 ASSERT_NE(kMachPortNull, port); | 56 ASSERT_NE(kMachPortNull, port); |
57 | 57 |
58 mach_port_type_t type; | 58 mach_port_type_t type; |
59 kern_return_t kr = mach_port_type(mach_task_self(), port, &type); | 59 kern_return_t kr = mach_port_type(mach_task_self(), port.get(), &type); |
60 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); | 60 ASSERT_EQ(KERN_SUCCESS, kr) << MachErrorMessage(kr, "mach_port_get_type"); |
61 | 61 |
62 EXPECT_EQ(MACH_PORT_TYPE_DEAD_NAME, type); | 62 EXPECT_EQ(MACH_PORT_TYPE_DEAD_NAME, type); |
63 } | 63 } |
64 | 64 |
65 const exception_mask_t kExcMaskBasic = | 65 const exception_mask_t kExcMaskBasic = |
66 EXC_MASK_BAD_ACCESS | | 66 EXC_MASK_BAD_ACCESS | |
67 EXC_MASK_BAD_INSTRUCTION | | 67 EXC_MASK_BAD_INSTRUCTION | |
68 EXC_MASK_ARITHMETIC | | 68 EXC_MASK_ARITHMETIC | |
69 EXC_MASK_EMULATION | | 69 EXC_MASK_EMULATION | |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_EQ(kMachPortNull, send); | 166 EXPECT_EQ(kMachPortNull, send); |
167 | 167 |
168 // It should be possible to check it in again. | 168 // It should be possible to check it in again. |
169 base::mac::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); | 169 base::mac::ScopedMachReceiveRight receive(BootstrapCheckIn(service_name)); |
170 EXPECT_NE(receive, kMachPortNull); | 170 EXPECT_NE(receive, kMachPortNull); |
171 } | 171 } |
172 | 172 |
173 TEST(MachExtensions, SystemCrashReporterHandler) { | 173 TEST(MachExtensions, SystemCrashReporterHandler) { |
174 base::mac::ScopedMachSendRight | 174 base::mac::ScopedMachSendRight |
175 system_crash_reporter_handler(SystemCrashReporterHandler()); | 175 system_crash_reporter_handler(SystemCrashReporterHandler()); |
176 EXPECT_TRUE(system_crash_reporter_handler); | 176 EXPECT_TRUE(system_crash_reporter_handler.is_valid()); |
177 } | 177 } |
178 | 178 |
179 } // namespace | 179 } // namespace |
180 } // namespace test | 180 } // namespace test |
181 } // namespace crashpad | 181 } // namespace crashpad |
OLD | NEW |