diff --git a/src/objective-c/tests/ChannelTests/ChannelPoolTest.m b/src/objective-c/tests/ChannelTests/ChannelPoolTest.m index d684db545e9..b85e62feb5f 100644 --- a/src/objective-c/tests/ChannelTests/ChannelPoolTest.m +++ b/src/objective-c/tests/ChannelTests/ChannelPoolTest.m @@ -47,14 +47,10 @@ NSString *kDummyHost = @"dummy.host"; GRPCChannelPool *pool = [GRPCChannelPool sharedInstance]; - GRPCChannel *channel1 = [pool channelWithHost:kDummyHost - callOptions:options1]; - GRPCChannel *channel2 = [pool channelWithHost:kDummyHost - callOptions:options2]; - GRPCChannel *channel3 = [pool channelWithHost:kDummyHost2 - callOptions:options1]; - GRPCChannel *channel4 = [pool channelWithHost:kDummyHost - callOptions:options3]; + GRPCChannel *channel1 = [pool channelWithHost:kDummyHost callOptions:options1]; + GRPCChannel *channel2 = [pool channelWithHost:kDummyHost callOptions:options2]; + GRPCChannel *channel3 = [pool channelWithHost:kDummyHost2 callOptions:options1]; + GRPCChannel *channel4 = [pool channelWithHost:kDummyHost callOptions:options3]; XCTAssertEqual(channel1, channel2); XCTAssertNotEqual(channel1, channel3); XCTAssertNotEqual(channel1, channel4); @@ -66,16 +62,14 @@ NSString *kDummyHost = @"dummy.host"; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; GRPCChannelPool *pool = [GRPCChannelPool sharedInstance]; - GRPCChannel *channel = [pool channelWithHost:kDummyHost - callOptions:options]; + GRPCChannel *channel = [pool channelWithHost:kDummyHost callOptions:options]; grpc_call *call = [channel unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] callOptions:options disconnected:nil]; [pool destroyAllChannels]; XCTAssertTrue(channel.disconnected); - GRPCChannel *channel2 = [pool channelWithHost:kDummyHost - callOptions:options]; + GRPCChannel *channel2 = [pool channelWithHost:kDummyHost callOptions:options]; XCTAssertNotEqual(channel, channel2); grpc_call_unref(call); } @@ -86,9 +80,8 @@ NSString *kDummyHost = @"dummy.host"; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; GRPCChannelPool *pool = [GRPCChannelPool sharedInstance]; - GRPCChannel *channel = [pool channelWithHost:kDummyHost - callOptions:options - destroyDelay:kDestroyDelay]; + GRPCChannel *channel = + [pool channelWithHost:kDummyHost callOptions:options destroyDelay:kDestroyDelay]; grpc_call *call = [channel unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] callOptions:options @@ -97,9 +90,8 @@ NSString *kDummyHost = @"dummy.host"; [channel unref]; // Test that we can still get the channel at this time - GRPCChannel *channel2 = [pool channelWithHost:kDummyHost - callOptions:options - destroyDelay:kDestroyDelay]; + GRPCChannel *channel2 = + [pool channelWithHost:kDummyHost callOptions:options destroyDelay:kDestroyDelay]; XCTAssertEqual(channel, channel2); call = [channel2 unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] @@ -117,9 +109,8 @@ NSString *kDummyHost = @"dummy.host"; GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init]; GRPCChannelPool *pool = [GRPCChannelPool sharedInstance]; - GRPCChannel *channel = [pool channelWithHost:kDummyHost - callOptions:options - destroyDelay:kDestroyDelay]; + GRPCChannel *channel = + [pool channelWithHost:kDummyHost callOptions:options destroyDelay:kDestroyDelay]; grpc_call *call = [channel unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] callOptions:options @@ -130,9 +121,8 @@ NSString *kDummyHost = @"dummy.host"; sleep(kDestroyDelay + 1); // Test that we get new channel to the same host and with the same callOptions - GRPCChannel *channel2 = [pool channelWithHost:kDummyHost - callOptions:options - destroyDelay:kDestroyDelay]; + GRPCChannel *channel2 = + [pool channelWithHost:kDummyHost callOptions:options destroyDelay:kDestroyDelay]; XCTAssertNotEqual(channel, channel2); } diff --git a/src/objective-c/tests/ChannelTests/ChannelTests.m b/src/objective-c/tests/ChannelTests/ChannelTests.m index 27e76d41799..5daafcdf3f3 100644 --- a/src/objective-c/tests/ChannelTests/ChannelTests.m +++ b/src/objective-c/tests/ChannelTests/ChannelTests.m @@ -33,12 +33,13 @@ } - (void)testTimedDisconnection { - NSString * const kHost = @"grpc-test.sandbox.googleapis.com"; + NSString *const kHost = @"grpc-test.sandbox.googleapis.com"; const NSTimeInterval kDestroyDelay = 1; GRPCCallOptions *options = [[GRPCCallOptions alloc] init]; - GRPCChannelConfiguration *configuration = [[GRPCChannelConfiguration alloc] initWithHost:kHost callOptions:options]; - GRPCChannel *channel = [[GRPCChannel alloc] initWithChannelConfiguration:configuration - destroyDelay:kDestroyDelay]; + GRPCChannelConfiguration *configuration = + [[GRPCChannelConfiguration alloc] initWithHost:kHost callOptions:options]; + GRPCChannel *channel = + [[GRPCChannel alloc] initWithChannelConfiguration:configuration destroyDelay:kDestroyDelay]; BOOL disconnected; grpc_call *call = [channel unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] @@ -61,12 +62,13 @@ } - (void)testForceDisconnection { - NSString * const kHost = @"grpc-test.sandbox.googleapis.com"; + NSString *const kHost = @"grpc-test.sandbox.googleapis.com"; const NSTimeInterval kDestroyDelay = 1; GRPCCallOptions *options = [[GRPCCallOptions alloc] init]; - GRPCChannelConfiguration *configuration = [[GRPCChannelConfiguration alloc] initWithHost:kHost callOptions:options]; - GRPCChannel *channel = [[GRPCChannel alloc] initWithChannelConfiguration:configuration - destroyDelay:kDestroyDelay]; + GRPCChannelConfiguration *configuration = + [[GRPCChannelConfiguration alloc] initWithHost:kHost callOptions:options]; + GRPCChannel *channel = + [[GRPCChannel alloc] initWithChannelConfiguration:configuration destroyDelay:kDestroyDelay]; grpc_call *call = [channel unmanagedCallWithPath:@"dummy.path" completionQueue:[GRPCCompletionQueue completionQueue] callOptions:options