aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/tests/GRPCClientTests.m
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-08-30 14:40:15 -0700
committerGravatar Muxi Yan <mxyan@google.com>2017-08-30 14:40:15 -0700
commitf282c8f525788e6f15331bb6c94471012a7e5346 (patch)
tree9a209804c3c3d2e7598c45dab0b6fa89b771a402 /src/objective-c/tests/GRPCClientTests.m
parent5646c7463c24ddd04e639ddd35b63db0c0dc06fb (diff)
Surface call deadline to Objective C API
Diffstat (limited to 'src/objective-c/tests/GRPCClientTests.m')
-rw-r--r--src/objective-c/tests/GRPCClientTests.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m
index 9afe507121..d9c6932ea8 100644
--- a/src/objective-c/tests/GRPCClientTests.m
+++ b/src/objective-c/tests/GRPCClientTests.m
@@ -422,4 +422,25 @@ static GRPCProtoMethod *kUnaryCallMethod;
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
+- (void)testDeadline {
+ __weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."];
+
+ GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress
+ path:kEmptyCallMethod.HTTPPath
+ requestsWriter:[GRXWriter writerWithValue:[NSData data]]];
+
+ id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) {
+ XCTAssert(0, @"Failure: response received; Expect: no response received.");
+ } completionHandler:^(NSError *errorOrNil) {
+ XCTAssertNotNil(errorOrNil, @"Failure: no error received; Expect: receive deadline exceeded.");
+ XCTAssertEqual(errorOrNil.code, GRPCErrorCodeDeadlineExceeded);
+ [completion fulfill];
+ }];
+
+ call.deadline = 1;
+ [call startWithWriteable:responsesWriteable];
+
+ [self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
+}
+
@end