mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-04 21:09:21 +08:00
Merge all copies of RUN_RUNLOOP_WHILE in UIExplorerUnitTests
Reviewed By: mhorowitz Differential Revision: D4921344 fbshipit-source-id: 8b00acba108e46c55374df54a027015d4327d683
This commit is contained in:
committed by
Facebook Github Bot
parent
59378f71db
commit
6b19419cdb
@@ -15,6 +15,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <RCTTest/RCTTestRunner.h>
|
||||
#import <React/RCTBridge+Private.h>
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
@@ -22,18 +23,6 @@
|
||||
#import <React/RCTUIManager.h>
|
||||
#import <React/RCTViewManager.h>
|
||||
|
||||
#define RUN_RUNLOOP_WHILE(CONDITION) \
|
||||
{ \
|
||||
NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:5]; \
|
||||
while ((CONDITION)) { \
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
|
||||
if ([timeout timeIntervalSinceNow] <= 0) { \
|
||||
XCTFail(@"Runloop timed out before condition was met"); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
@interface RCTTestViewManager : RCTViewManager
|
||||
@end
|
||||
|
||||
@@ -127,7 +116,7 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)testViewManagerNotInitializedBeforeSetBridgeModule
|
||||
{
|
||||
RUN_RUNLOOP_WHILE(!_notificationObserver.didDetectViewManagerInit);
|
||||
RCT_RUN_RUNLOOP_WHILE(!_notificationObserver.didDetectViewManagerInit);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user