|
|
@ -129,6 +129,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
- (void)testServerStreamingRPC { |
|
|
|
- (void)testServerStreamingRPC { |
|
|
|
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"]; |
|
|
|
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"]; |
|
|
|
|
|
|
|
|
|
|
|
NSArray *expectedSizes = @[@31415, @9, @2653, @58979]; |
|
|
|
NSArray *expectedSizes = @[@31415, @9, @2653, @58979]; |
|
|
|
|
|
|
|
|
|
|
|
RMTStreamingOutputCallRequest *request = [RMTStreamingOutputCallRequest message]; |
|
|
|
RMTStreamingOutputCallRequest *request = [RMTStreamingOutputCallRequest message]; |
|
|
@ -144,15 +145,22 @@ |
|
|
|
RMTStreamingOutputCallResponse *response, |
|
|
|
RMTStreamingOutputCallResponse *response, |
|
|
|
NSError *error){ |
|
|
|
NSError *error){ |
|
|
|
XCTAssertNil(error, @"Finished with unexpected error: %@", error); |
|
|
|
XCTAssertNil(error, @"Finished with unexpected error: %@", error); |
|
|
|
|
|
|
|
XCTAssertTrue(done || response, @"Event handler called without an event."); |
|
|
|
RMTStreamingOutputCallResponse *expectedResponse = [RMTStreamingOutputCallResponse message]; |
|
|
|
|
|
|
|
expectedResponse.payload.type = RMTPayloadType_Compressable; |
|
|
|
if (response) { |
|
|
|
int expectedSize = [expectedSizes[index] unsignedIntegerValue]; |
|
|
|
XCTAssertLessThan(index, 4, @"More than 4 responses received."); |
|
|
|
expectedResponse.payload.body = [NSMutableData dataWithLength:expectedSize]; |
|
|
|
RMTStreamingOutputCallResponse * expected = [RMTStreamingOutputCallResponse message]; |
|
|
|
XCTAssertEqualObjects(response, expectedResponse); |
|
|
|
expected.payload.type = RMTPayloadType_Compressable; |
|
|
|
|
|
|
|
int expectedSize = [expectedSizes[index] unsignedIntegerValue]; |
|
|
|
[expectation fulfill]; |
|
|
|
expected.payload.body = [NSMutableData dataWithLength:expectedSize]; |
|
|
|
index += 1; |
|
|
|
XCTAssertEqualObjects(response, expected); |
|
|
|
|
|
|
|
index += 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (done) { |
|
|
|
|
|
|
|
XCTAssertEqual(index, 4, @"Received %i responses instead of 4.", index); |
|
|
|
|
|
|
|
[expectation fulfill]; |
|
|
|
|
|
|
|
} |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
[self waitForExpectationsWithTimeout:4 handler:nil]; |
|
|
|
[self waitForExpectationsWithTimeout:4 handler:nil]; |
|
|
|