| Index: webrtc/test/mac/run_test.mm
|
| diff --git a/webrtc/test/mac/run_test.mm b/webrtc/test/mac/run_test.mm
|
| index 4e0093a9b6e40f6c13b52ede10e0bdd0cc100bd7..7576b5576373117b2337fd677bc5630b7c448d80 100644
|
| --- a/webrtc/test/mac/run_test.mm
|
| +++ b/webrtc/test/mac/run_test.mm
|
| @@ -36,10 +36,10 @@ TestBlock functionToBlock(void(*function)()) {
|
| }
|
|
|
| - (void)runAllTests:(TestBlock)testBlock {
|
| - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
| - testBlock();
|
| - running_ = NO;
|
| - [pool release];
|
| + @autoreleasepool {
|
| + testBlock();
|
| + running_ = NO;
|
| + }
|
| }
|
|
|
| - (BOOL)running {
|
| @@ -51,24 +51,22 @@ namespace webrtc {
|
| namespace test {
|
|
|
| void RunTest(void(*test)()) {
|
| - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
| - [NSApplication sharedApplication];
|
| + @autoreleasepool {
|
| + [NSApplication sharedApplication];
|
|
|
| - // Convert the function pointer to an Objective-C block and call on a
|
| - // separate thread, to avoid blocking the main thread.
|
| - TestRunner *testRunner = [[TestRunner alloc] init];
|
| - TestBlock testBlock = functionToBlock(test);
|
| - [NSThread detachNewThreadSelector:@selector(runAllTests:)
|
| - toTarget:testRunner
|
| - withObject:testBlock];
|
| + // Convert the function pointer to an Objective-C block and call on a
|
| + // separate thread, to avoid blocking the main thread.
|
| + TestRunner *testRunner = [[TestRunner alloc] init];
|
| + TestBlock testBlock = functionToBlock(test);
|
| + [NSThread detachNewThreadSelector:@selector(runAllTests:)
|
| + toTarget:testRunner
|
| + withObject:testBlock];
|
|
|
| - NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
| - while ([testRunner running] &&
|
| - [runLoop runMode:NSDefaultRunLoopMode
|
| - beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
|
| -
|
| - [testRunner release];
|
| - [pool release];
|
| + NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
| + while ([testRunner running] && [runLoop runMode:NSDefaultRunLoopMode
|
| + beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]])
|
| + ;
|
| + }
|
| }
|
|
|
| } // namespace test
|
|
|