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..d6df69c46a8cf91c3bad40fe00f9a9205435215f 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,23 @@ 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]]); |
+ NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; |
+ while ([testRunner running] && |
+ [runLoop runMode:NSDefaultRunLoopMode |
+ beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]); |
+ } |
- [testRunner release]; |
- [pool release]; |
} |
} // namespace test |