| Index: chrome/browser/mac/exception_processor_unittest.mm
|
| diff --git a/chrome/browser/mac/exception_processor_unittest.mm b/chrome/browser/mac/exception_processor_unittest.mm
|
| index 0e8460be058769ea5003adcc09c4ff5dc24040f1..78f570b54ff779aefd7cc08b5fed27f5ff5eca51 100644
|
| --- a/chrome/browser/mac/exception_processor_unittest.mm
|
| +++ b/chrome/browser/mac/exception_processor_unittest.mm
|
| @@ -154,6 +154,65 @@ TEST(ExceptionProcessorTest, ThrowAndCatchExceptionInRunLoop) {
|
| ".*TEST PASS.*");
|
| }
|
|
|
| +void ThrowExceptionFromSelector() {
|
| + base::mac::DisableOSCrashDumps();
|
| + chrome::InstallObjcExceptionPreprocessor();
|
| +
|
| + NSException* exception = [NSException exceptionWithName:@"ThrowFromSelector"
|
| + reason:@""
|
| + userInfo:nil];
|
| +
|
| + [exception performSelector:@selector(raise) withObject:nil afterDelay:0.1];
|
| +
|
| + [[NSRunLoop currentRunLoop] runUntilDate:
|
| + [NSDate dateWithTimeIntervalSinceNow:10]];
|
| +
|
| + fprintf(stderr, "TEST FAILED\n");
|
| + exit(1);
|
| +}
|
| +
|
| +TEST(ExceptionProcessorTest, ThrowExceptionFromSelector) {
|
| + ::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
| + EXPECT_DEATH(ThrowExceptionFromSelector(),
|
| + ".*FATAL:exception_processor\\.mm.*"
|
| + "Terminating from Objective-C exception:.*");
|
| +}
|
| +
|
| +void ThrowInNotificationObserver() {
|
| + base::mac::DisableOSCrashDumps();
|
| + chrome::InstallObjcExceptionPreprocessor();
|
| +
|
| + NSNotification* notification =
|
| + [NSNotification notificationWithName:@"TestExceptionInObserver"
|
| + object:nil];
|
| +
|
| + NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
|
| + [center addObserverForName:[notification name]
|
| + object:nil
|
| + queue:nil
|
| + usingBlock:^(NSNotification*) {
|
| + [NSException raise:@"ThrowInNotificationObserver"
|
| + format:@""];
|
| + }];
|
| +
|
| + [center performSelector:@selector(postNotification:)
|
| + withObject:notification
|
| + afterDelay:0];
|
| +
|
| + [[NSRunLoop currentRunLoop] runUntilDate:
|
| + [NSDate dateWithTimeIntervalSinceNow:10]];
|
| +
|
| + fprintf(stderr, "TEST FAILED\n");
|
| + exit(1);
|
| +}
|
| +
|
| +TEST(ExceptionProcessorTest, ThrowInNotificationObserver) {
|
| + ::testing::FLAGS_gtest_death_test_style = "threadsafe";
|
| + EXPECT_DEATH(ThrowInNotificationObserver(),
|
| + ".*FATAL:exception_processor\\.mm.*"
|
| + "Terminating from Objective-C exception:.*");
|
| +}
|
| +
|
| void ThrowExceptionInRunLoopWithoutProcessor() {
|
| base::mac::DisableOSCrashDumps();
|
| chrome::UninstallObjcExceptionPreprocessor();
|
|
|