aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/examples/Sample/SampleTests
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-05-15 10:37:09 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-05-15 10:37:09 -0700
commitea43b903a3f2a499752720f0102441dc2694611e (patch)
tree36816e2485878de994780cdf45416840522621a4 /src/objective-c/examples/Sample/SampleTests
parente195aa0ef7026e5a4e60b4ab7e3cb11338d79fbb (diff)
Added server_streaming interop test
Diffstat (limited to 'src/objective-c/examples/Sample/SampleTests')
-rw-r--r--src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m b/src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
index 2ef6a6e4ab..322d86d04b 100644
--- a/src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
+++ b/src/objective-c/examples/Sample/SampleTests/RemoteProtoTests.m
@@ -69,7 +69,7 @@
}
- (void)testLargeUnaryRPC {
- __weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyUnary"];
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"LargeUnary"];
RMTSimpleRequest *request = [[[[[[RMTSimpleRequestBuilder alloc] init]
setResponseType:RMTPayloadTypeCompressable]
@@ -95,7 +95,7 @@
}
- (void)testClientStreamingRPC {
- __weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyUnary"];
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"];
id request1 = [[[[RMTStreamingInputCallRequestBuilder alloc] init]
setPayloadBuilder:[[[RMTPayloadBuilder alloc] init]
@@ -130,4 +130,34 @@
[self waitForExpectationsWithTimeout:4. handler:nil];
}
+- (void)testServerStreamingRPC {
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"ServerStreaming"];
+ NSArray *expectedSizes = @[@31415, @9, @2653, @58979];
+ int index = 0;
+ id request = [[[[[[[RMTStreamingOutputCallRequestBuilder alloc] init]
+ addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
+ setSize:31415] build]]
+ addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
+ setSize:9] build]]
+ addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
+ setSize:2653] build]]
+ addResponseParameters:[[[[RMTResponseParametersBuilder alloc] init]
+ setSize:58979] build]]
+ build];
+ [_service streamingOutputCallWithRequest:request handler:^(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error){
+ XCTAssertNil(error, @"Finished with unexpected error: %@", error);
+
+ id expectedResponseBuilder = [[RMTStreamingOutputCallResponseBuilder alloc] init];
+ id expectedPayload = [[[RMTPayloadBuilder alloc] init]
+ setBody:[NSMutableData dataWithLength:expectedSizes[index]]];
+ expectedResponseBuilder = [expectedResponseBuilder setPayload:expectedPayload];
+ id expectedResponse = [expectedResponseBuilder build];
+ XCTAssertEqualObjects(response, expectedResponse);
+
+ [expectation fulfill];
+ }];
+
+ [self waitForExpectationsWithTimeout:4 handler:nil];
+}
+
@end