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

Side by Side Diff: webrtc/test/mac/run_test.mm

Issue 2834273002: Reland of GN: Enable ARC for Mac and iOS in rtc_* templates (Closed)
Patch Set: Make sure PeerConnection is released before factory Created 3 years, 8 months 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 | « webrtc/test/BUILD.gn ('k') | webrtc/test/mac/video_renderer_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 18 matching lines...) Expand all
29 @implementation TestRunner 29 @implementation TestRunner
30 - (id)init { 30 - (id)init {
31 self = [super init]; 31 self = [super init];
32 if (self) { 32 if (self) {
33 running_ = YES; 33 running_ = YES;
34 } 34 }
35 return self; 35 return self;
36 } 36 }
37 37
38 - (void)runAllTests:(TestBlock)testBlock { 38 - (void)runAllTests:(TestBlock)testBlock {
39 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 39 @autoreleasepool {
40 testBlock(); 40 testBlock();
41 running_ = NO; 41 running_ = NO;
42 [pool release]; 42 }
43 } 43 }
44 44
45 - (BOOL)running { 45 - (BOOL)running {
46 return running_; 46 return running_;
47 } 47 }
48 @end 48 @end
49 49
50 namespace webrtc { 50 namespace webrtc {
51 namespace test { 51 namespace test {
52 52
53 void RunTest(void(*test)()) { 53 void RunTest(void(*test)()) {
54 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 54 @autoreleasepool {
55 [NSApplication sharedApplication]; 55 [NSApplication sharedApplication];
56 56
57 // Convert the function pointer to an Objective-C block and call on a 57 // Convert the function pointer to an Objective-C block and call on a
58 // separate thread, to avoid blocking the main thread. 58 // separate thread, to avoid blocking the main thread.
59 TestRunner *testRunner = [[TestRunner alloc] init]; 59 TestRunner *testRunner = [[TestRunner alloc] init];
60 TestBlock testBlock = functionToBlock(test); 60 TestBlock testBlock = functionToBlock(test);
61 [NSThread detachNewThreadSelector:@selector(runAllTests:) 61 [NSThread detachNewThreadSelector:@selector(runAllTests:)
62 toTarget:testRunner 62 toTarget:testRunner
63 withObject:testBlock]; 63 withObject:testBlock];
64 64
65 NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; 65 NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
66 while ([testRunner running] && 66 while ([testRunner running] && [runLoop runMode:NSDefaultRunLoopMode
67 [runLoop runMode:NSDefaultRunLoopMode 67 beforeDate:[NSDate dateWithTimeInterval SinceNow:0.1]])
68 beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]); 68 ;
69 69 }
70 [testRunner release];
71 [pool release];
72 } 70 }
73 71
74 } // namespace test 72 } // namespace test
75 } // namespace webrtc 73 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/BUILD.gn ('k') | webrtc/test/mac/video_renderer_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698