| Index: util/mach/exception_ports_test.cc
|
| diff --git a/util/mach/exception_ports_test.cc b/util/mach/exception_ports_test.cc
|
| index 8a459f40dc2bd03e94adf6a065f4587faa08a257..88de265a8631c04957f7b921bace237011cccbba 100644
|
| --- a/util/mach/exception_ports_test.cc
|
| +++ b/util/mach/exception_ports_test.cc
|
| @@ -44,8 +44,9 @@ using namespace crashpad::test;
|
| // behavior matches |expect_behavior| exactly. In this case, if
|
| // |expect_behavior| is a state-carrying behavior, the looked-up thread state
|
| // flavor is expected to be MACHINE_THREAD_STATE, otherwise, it is expected to
|
| -// be THREAD_STATE_NONE. If |expect_port| is MACH_PORT_NULL, no handler for
|
| -// EXC_MASK_CRASH is expected to be found.
|
| +// be THREAD_STATE_NONE. If |expect_port| is MACH_PORT_NULL, either no handler
|
| +// for EXC_MASK_CRASH is expected to be found, or a handler whose port is
|
| +// MACH_PORT_NULL is expected, with the behavior and flavor being irrelevant.
|
| //
|
| // A second GetExceptionPorts() lookup is also performed on a wider exception
|
| // mask, EXC_MASK_ALL | EXC_MASK_CRASH. The EXC_MASK_CRASH handler’s existence
|
| @@ -66,16 +67,16 @@ void TestGetExceptionPorts(const ExceptionPorts& exception_ports,
|
| ASSERT_TRUE(
|
| exception_ports.GetExceptionPorts(kExceptionMask, &crash_handler));
|
|
|
| - if (expect_port != MACH_PORT_NULL) {
|
| + if (expect_port != MACH_PORT_NULL || !crash_handler.empty()) {
|
| ASSERT_EQ(1u, crash_handler.size());
|
| base::mac::ScopedMachSendRight port_owner(crash_handler[0].port);
|
|
|
| EXPECT_EQ(kExceptionMask, crash_handler[0].mask);
|
| EXPECT_EQ(expect_port, crash_handler[0].port);
|
| - EXPECT_EQ(expect_behavior, crash_handler[0].behavior);
|
| - EXPECT_EQ(expect_flavor, crash_handler[0].flavor);
|
| - } else {
|
| - EXPECT_TRUE(crash_handler.empty());
|
| + if (expect_port != MACH_PORT_NULL) {
|
| + EXPECT_EQ(expect_behavior, crash_handler[0].behavior);
|
| + EXPECT_EQ(expect_flavor, crash_handler[0].flavor);
|
| + }
|
| }
|
|
|
| std::vector<ExceptionPorts::ExceptionHandler> handlers;
|
| @@ -88,11 +89,16 @@ void TestGetExceptionPorts(const ExceptionPorts& exception_ports,
|
| if ((handler.mask & kExceptionMask) != 0) {
|
| base::mac::ScopedMachSendRight port_owner(handler.port);
|
|
|
| - EXPECT_FALSE(found);
|
| - found = true;
|
| + if (handler.port != MACH_PORT_NULL) {
|
| + EXPECT_FALSE(found);
|
| + found = true;
|
| + }
|
| +
|
| EXPECT_EQ(expect_port, handler.port);
|
| - EXPECT_EQ(expect_behavior, handler.behavior);
|
| - EXPECT_EQ(expect_flavor, handler.flavor);
|
| + if (expect_port != MACH_PORT_NULL) {
|
| + EXPECT_EQ(expect_behavior, handler.behavior);
|
| + EXPECT_EQ(expect_flavor, handler.flavor);
|
| + }
|
| }
|
| }
|
|
|
|
|