aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/tests
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-11-28 11:22:33 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-11-28 11:22:33 -0800
commita7c41346d8470e7eb5f10234daa08d09a48fa779 (patch)
treee84a9ff9668bd6ea579cd68d8a7b5d694eb43df2 /src/objective-c/tests
parentfd69f74b2091ae66b609ec7592905d9b20dddf88 (diff)
Add one more cancel test
Diffstat (limited to 'src/objective-c/tests')
-rw-r--r--src/objective-c/tests/InteropTests.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m
index a9f33aab6f..2492718046 100644
--- a/src/objective-c/tests/InteropTests.m
+++ b/src/objective-c/tests/InteropTests.m
@@ -655,6 +655,37 @@ BOOL isRemoteInteropTest(NSString *host) {
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
+- (void)testCancelAfterFirstRequestWithV2API {
+ XCTAssertNotNil([[self class] host]);
+ __weak XCTestExpectation *completionExpectation =
+ [self expectationWithDescription:@"Call completed."];
+
+ GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
+ options.transportType = self.class.transportType;
+ options.PEMRootCertificates = self.class.PEMRootCertificates;
+ options.hostNameOverride = [[self class] hostNameOverride];
+
+ id request =
+ [RMTStreamingOutputCallRequest messageWithPayloadSize:@21782 requestedResponseSize:@31415];
+
+ __block GRPCStreamingProtoCall *call = [_service
+ fullDuplexCallWithResponseHandler:[[InteropTestsBlockCallbacks alloc]
+ initWithInitialMetadataCallback:nil
+ messageCallback:^(id message) {
+ XCTFail(@"Received unexpected response.");
+ }
+ closeCallback:^(NSDictionary *trailingMetadata,
+ NSError *error) {
+ XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED);
+ [completionExpectation fulfill];
+ }]
+ callOptions:options];
+
+ [call writeMessage:request];
+ [call cancel];
+ [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
+}
+
- (void)testRPCAfterClosingOpenConnections {
XCTAssertNotNil([[self class] host]);
__weak XCTestExpectation *expectation =