Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: chrome/browser/mac/exception_processor_unittest.mm

Issue 2565093002: [Mac] Fix unit_tests build in 10.12 SDK. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/mac/exception_processor.h" 5 #import "chrome/browser/mac/exception_processor.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <sys/wait.h> 9 #include <sys/wait.h>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_TRUE(histograms[0]->HasConstructionArguments(1, 88 EXPECT_TRUE(histograms[0]->HasConstructionArguments(1,
89 kUnknownNSException, 89 kUnknownNSException,
90 kUnknownNSException + 1)); 90 kUnknownNSException + 1));
91 EXPECT_EQ(4, samples->GetCount(kUnknownNSException)); 91 EXPECT_EQ(4, samples->GetCount(kUnknownNSException));
92 } 92 }
93 93
94 void RaiseExceptionInRunLoop() { 94 void RaiseExceptionInRunLoop() {
95 CFRunLoopRef run_loop = CFRunLoopGetCurrent(); 95 CFRunLoopRef run_loop = CFRunLoopGetCurrent();
96 96
97 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{ 97 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{
98 [NSException raise:@"ThrowExceptionInRunLoop" format:nil]; 98 [NSException raise:@"ThrowExceptionInRunLoop" format:@""];
99 }); 99 });
100 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{ 100 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{
101 CFRunLoopStop(run_loop); 101 CFRunLoopStop(run_loop);
102 }); 102 });
103 CFRunLoopRun(); 103 CFRunLoopRun();
104 } 104 }
105 105
106 void ThrowExceptionInRunLoop() { 106 void ThrowExceptionInRunLoop() {
107 base::mac::DisableOSCrashDumps(); 107 base::mac::DisableOSCrashDumps();
108 chrome::InstallObjcExceptionPreprocessor(); 108 chrome::InstallObjcExceptionPreprocessor();
(...skipping 13 matching lines...) Expand all
122 "Terminating from Objective-C exception:.*"); 122 "Terminating from Objective-C exception:.*");
123 } 123 }
124 124
125 void ThrowAndCatchExceptionInRunLoop() { 125 void ThrowAndCatchExceptionInRunLoop() {
126 base::mac::DisableOSCrashDumps(); 126 base::mac::DisableOSCrashDumps();
127 chrome::InstallObjcExceptionPreprocessor(); 127 chrome::InstallObjcExceptionPreprocessor();
128 128
129 CFRunLoopRef run_loop = CFRunLoopGetCurrent(); 129 CFRunLoopRef run_loop = CFRunLoopGetCurrent();
130 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{ 130 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{
131 @try { 131 @try {
132 [NSException raise:@"ObjcExceptionPreprocessCaught" format:nil]; 132 [NSException raise:@"ObjcExceptionPreprocessCaught" format:@""];
133 } @catch (id exception) { 133 } @catch (id exception) {
134 } 134 }
135 }); 135 });
136 136
137 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{ 137 CFRunLoopPerformBlock(run_loop, kCFRunLoopCommonModes, ^{
138 CFRunLoopStop(run_loop); 138 CFRunLoopStop(run_loop);
139 }); 139 });
140 140
141 CFRunLoopRun(); 141 CFRunLoopRun();
142 142
(...skipping 30 matching lines...) Expand all
173 TEST(ExceptionProcessorTest, ThrowExceptionInRunLoopWithoutProcessor) { 173 TEST(ExceptionProcessorTest, ThrowExceptionInRunLoopWithoutProcessor) {
174 ::testing::FLAGS_gtest_death_test_style = "threadsafe"; 174 ::testing::FLAGS_gtest_death_test_style = "threadsafe";
175 EXPECT_EXIT(ThrowExceptionInRunLoopWithoutProcessor(), 175 EXPECT_EXIT(ThrowExceptionInRunLoopWithoutProcessor(),
176 [](int exit_code) -> bool { 176 [](int exit_code) -> bool {
177 return WEXITSTATUS(exit_code) == 0; 177 return WEXITSTATUS(exit_code) == 0;
178 }, 178 },
179 ".*TEST PASS.*"); 179 ".*TEST PASS.*");
180 } 180 }
181 181
182 } // namespace chrome 182 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698