fix testHijackingInterceptor

pull/19322/head
Muxi Yan 6 years ago
parent a9ad58e037
commit 9640bcddc2
  1. 9
      src/objective-c/tests/InteropTests/InteropTests.m

@ -1497,8 +1497,10 @@ static dispatch_once_t initGlobalInterceptorFactory;
- (void)testHijackingInterceptor { - (void)testHijackingInterceptor {
NSUInteger kCancelAfterWrites = 2; NSUInteger kCancelAfterWrites = 2;
XCTAssertNotNil([[self class] host]); XCTAssertNotNil([[self class] host]);
__weak XCTestExpectation *expectation = __weak XCTestExpectation *expectUserCallComplete =
[self expectationWithDescription:@"testHijackingInterceptor"]; [self expectationWithDescription:@"User call completed."];
__weak XCTestExpectation *expectCallInternalComplete =
[self expectationWithDescription:@"Internal gRPC call completed."];
NSArray *responses = @[ @1, @2, @3, @4 ]; NSArray *responses = @[ @1, @2, @3, @4 ];
__block int index = 0; __block int index = 0;
@ -1555,6 +1557,7 @@ static dispatch_once_t initGlobalInterceptorFactory;
XCTAssertNil(trailingMetadata); XCTAssertNil(trailingMetadata);
XCTAssertNotNil(error); XCTAssertNotNil(error);
XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED); XCTAssertEqual(error.code, GRPC_STATUS_CANCELLED);
[expectCallInternalComplete fulfill];
} }
didWriteDataHook:nil]; didWriteDataHook:nil];
@ -1596,7 +1599,7 @@ static dispatch_once_t initGlobalInterceptorFactory;
XCTAssertEqual(index, 4, XCTAssertEqual(index, 4,
@"Received %i responses instead of 4.", @"Received %i responses instead of 4.",
index); index);
[expectation fulfill]; [expectUserCallComplete fulfill];
}] }]
callOptions:options]; callOptions:options];
[call start]; [call start];

Loading…
Cancel
Save