diff options
Diffstat (limited to 'src/objective-c/GRPCClient/GRPCCall+Tests.m')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall+Tests.m | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m index 656cba8fec..fe864707e0 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Tests.m +++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m @@ -64,4 +64,41 @@ + (void)resetHostSettings { [GRPCHost resetAllHostSettings]; } + +static NSMutableArray *opBatchLog = nil; + ++ (void)enableOpBatchLog:(BOOL)enabled { + @synchronized (opBatchLog) { + if (enabled) { + if (!opBatchLog) { + opBatchLog = [NSMutableArray array]; + } + } else { + if (opBatchLog) { + opBatchLog = nil; + } + } + } +} + ++ (void)addOpBatchToLog:(NSArray *)batch { + @synchronized (opBatchLog) { + if (opBatchLog) { + [opBatchLog addObject:batch]; + } + } +} + ++ (NSArray *)obtainAndCleanOpBatchLog { + @synchronized (opBatchLog) { + if (opBatchLog) { + NSArray *out = opBatchLog; + opBatchLog = [NSMutableArray array]; + return out; + } else { + return nil; + } + } +} + @end |