aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/tests
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2017-02-01 14:49:03 -0800
committerGravatar Muxi Yan <mxyan@google.com>2017-02-01 15:04:16 -0800
commit0a2fae9aedeef98b39c5f825cb28b5ca32ecc6a2 (patch)
tree44a4263bda6fa95680cba4eaea8ab567052881fb /src/objective-c/tests
parenteb5ee45eec0c6f88bcf649f383060f3dc34f2084 (diff)
Dynamically enable packet coalescing by channel args
Diffstat (limited to 'src/objective-c/tests')
-rw-r--r--src/objective-c/tests/CronetUnitTests/CronetUnitTests.m20
-rw-r--r--src/objective-c/tests/Podfile1
2 files changed, 15 insertions, 6 deletions
diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
index dcd7f2fa8d..d06fe7767f 100644
--- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
+++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
@@ -269,7 +269,12 @@ unsigned int parse_h2_length(const char *field) {
grpc_completion_queue_destroy(cq);
}
-- (void)testPacketCoalescing {
+- (void)PacketCoalescing:(bool)use_coalescing {
+ grpc_arg arg;
+ arg.key = GRPC_ARG_USE_CRONET_PACKET_COALESCING;
+ arg.type = GRPC_ARG_INTEGER;
+ arg.value.integer = use_coalescing ? 1:0;
+ grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
grpc_call *c;
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
@@ -285,8 +290,8 @@ unsigned int parse_h2_length(const char *field) {
gpr_join_host_port(&addr, "127.0.0.1", port);
grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
stream_engine *cronetEngine = [Cronet getGlobalEngine];
- grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr,
- NULL, NULL);
+ grpc_channel *client =
+ grpc_cronet_secure_channel_create(cronetEngine, addr, args, NULL);
cq_verifier *cqv = cq_verifier_create(cq);
grpc_op ops[6];
@@ -379,7 +384,7 @@ unsigned int parse_h2_length(const char *field) {
long len;
bool coalesced = false;
while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) {
- NSLog(@"Read len: %ld", len);
+ gpr_log(GPR_DEBUG, "Read len: %ld", len);
// Analyze the HTTP/2 frames in the same TLS PDU to identify if
// coalescing is successful
@@ -404,7 +409,7 @@ unsigned int parse_h2_length(const char *field) {
}
}
- XCTAssert(coalesced);
+ XCTAssert(coalesced == use_coalescing);
SSL_free(ssl);
SSL_CTX_free(ctx);
close(s);
@@ -433,4 +438,9 @@ unsigned int parse_h2_length(const char *field) {
grpc_completion_queue_destroy(cq);
}
+- (void)testPacketCoalescing {
+ [self PacketCoalescing:true];
+ [self PacketCoalescing:false];
+}
+
@end
diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile
index 462c6a8e0e..3760330be9 100644
--- a/src/objective-c/tests/Podfile
+++ b/src/objective-c/tests/Podfile
@@ -97,7 +97,6 @@ post_install do |installer|
# GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
# function" warning
config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
- config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1'
end
end