aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/tests/ChannelTests/ChannelTests.m
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-12-06 22:41:03 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-12-06 22:41:03 -0800
commitf0f6e03212837c67d7e078e6f33074e80aa4bcc0 (patch)
tree28cf8e66afe60a741dda4fe07db29ff65dac6919 /src/objective-c/tests/ChannelTests/ChannelTests.m
parent1a9404876ce0315fc05fe82465dc389600db0965 (diff)
clang-format
Diffstat (limited to 'src/objective-c/tests/ChannelTests/ChannelTests.m')
-rw-r--r--src/objective-c/tests/ChannelTests/ChannelTests.m49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/objective-c/tests/ChannelTests/ChannelTests.m b/src/objective-c/tests/ChannelTests/ChannelTests.m
index 7c80868c2c..df78e8b116 100644
--- a/src/objective-c/tests/ChannelTests/ChannelTests.m
+++ b/src/objective-c/tests/ChannelTests/ChannelTests.m
@@ -20,8 +20,8 @@
#import "../../GRPCClient/GRPCCallOptions.h"
#import "../../GRPCClient/private/GRPCChannel.h"
-#import "../../GRPCClient/private/GRPCChannelPool.h"
#import "../../GRPCClient/private/GRPCChannelPool+Test.h"
+#import "../../GRPCClient/private/GRPCChannelPool.h"
#import "../../GRPCClient/private/GRPCCompletionQueue.h"
#import "../../GRPCClient/private/GRPCWrappedCall.h"
@@ -40,13 +40,12 @@ static NSString *kDummyPath = @"/dummy/path";
- (void)testPooledChannelCreatingChannel {
GRPCCallOptions *options = [[GRPCCallOptions alloc] init];
- GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost
- callOptions:options];
+ GRPCChannelConfiguration *config =
+ [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost callOptions:options];
GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config];
GRPCCompletionQueue *cq = [GRPCCompletionQueue completionQueue];
- GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ GRPCWrappedCall *wrappedCall =
+ [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertNotNil(channel.wrappedChannel);
(void)wrappedCall;
}
@@ -54,26 +53,22 @@ static NSString *kDummyPath = @"/dummy/path";
- (void)testTimedDestroyChannel {
const NSTimeInterval kDestroyDelay = 1.0;
GRPCCallOptions *options = [[GRPCCallOptions alloc] init];
- GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost
- callOptions:options];
- GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config
- destroyDelay:kDestroyDelay];
+ GRPCChannelConfiguration *config =
+ [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost callOptions:options];
+ GRPCPooledChannel *channel =
+ [[GRPCPooledChannel alloc] initWithChannelConfiguration:config destroyDelay:kDestroyDelay];
GRPCCompletionQueue *cq = [GRPCCompletionQueue completionQueue];
GRPCWrappedCall *wrappedCall;
GRPCChannel *wrappedChannel;
@autoreleasepool {
- wrappedCall = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertNotNil(channel.wrappedChannel);
// Unref and ref channel immediately; expect using the same raw channel.
wrappedChannel = channel.wrappedChannel;
wrappedCall = nil;
- wrappedCall = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertEqual(channel.wrappedChannel, wrappedChannel);
// Unref and ref channel after destroy delay; expect a new raw channel.
@@ -81,23 +76,20 @@ static NSString *kDummyPath = @"/dummy/path";
}
sleep(kDestroyDelay + 1);
XCTAssertNil(channel.wrappedChannel);
- wrappedCall = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ wrappedCall = [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertNotEqual(channel.wrappedChannel, wrappedChannel);
}
- (void)testDisconnect {
const NSTimeInterval kDestroyDelay = 1.0;
GRPCCallOptions *options = [[GRPCCallOptions alloc] init];
- GRPCChannelConfiguration *config = [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost
- callOptions:options];
- GRPCPooledChannel *channel = [[GRPCPooledChannel alloc] initWithChannelConfiguration:config
- destroyDelay:kDestroyDelay];
+ GRPCChannelConfiguration *config =
+ [[GRPCChannelConfiguration alloc] initWithHost:kDummyHost callOptions:options];
+ GRPCPooledChannel *channel =
+ [[GRPCPooledChannel alloc] initWithChannelConfiguration:config destroyDelay:kDestroyDelay];
GRPCCompletionQueue *cq = [GRPCCompletionQueue completionQueue];
- GRPCWrappedCall *wrappedCall = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ GRPCWrappedCall *wrappedCall =
+ [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertNotNil(channel.wrappedChannel);
// Disconnect; expect wrapped channel to be dropped
@@ -106,9 +98,8 @@ static NSString *kDummyPath = @"/dummy/path";
// Create a new call and unref the old call; confirm that destroy of the old call does not make
// the channel disconnect, even after the destroy delay.
- GRPCWrappedCall *wrappedCall2 = [channel wrappedCallWithPath:kDummyPath
- completionQueue:cq
- callOptions:options];
+ GRPCWrappedCall *wrappedCall2 =
+ [channel wrappedCallWithPath:kDummyPath completionQueue:cq callOptions:options];
XCTAssertNotNil(channel.wrappedChannel);
GRPCChannel *wrappedChannel = channel.wrappedChannel;
wrappedCall = nil;