aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security
diff options
context:
space:
mode:
authorGravatar jiangtaoli2016 <jiangtao@google.com>2017-09-07 09:54:28 -0700
committerGravatar jiangtaoli2016 <jiangtao@google.com>2017-09-07 09:54:28 -0700
commitc88e1dee435817f644c55a7087b085dd4927727a (patch)
treeb06a59a99a6b304aa93899ef9ffb53cc206d0a0f /test/core/security
parente12f5f28b5052330b984ab2e42078efe78141ad0 (diff)
fix secure_endpoint_test
Diffstat (limited to 'test/core/security')
-rw-r--r--test/core/security/secure_endpoint_test.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 2145d55da7..e9f2c76738 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -44,9 +44,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
tsi_frame_protector *fake_write_protector =
tsi_create_fake_frame_protector(NULL);
tsi_zero_copy_grpc_protector *fake_read_zero_copy_protector =
- tsi_create_fake_zero_copy_grpc_protector(NULL);
+ use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL)
+ : NULL;
tsi_zero_copy_grpc_protector *fake_write_zero_copy_protector =
- tsi_create_fake_zero_copy_grpc_protector(NULL);
+ use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL)
+ : NULL;
grpc_endpoint_test_fixture f;
grpc_endpoint_pair tcp;
@@ -59,12 +61,9 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset);
if (leftover_nslices == 0) {
- f.client_ep =
- use_zero_copy_protector
- ? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector,
- tcp.client, NULL, 0)
- : grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client,
- NULL, 0);
+ f.client_ep = grpc_secure_endpoint_create(fake_read_protector,
+ fake_read_zero_copy_protector,
+ tcp.client, NULL, 0);
} else {
unsigned i;
tsi_result result;
@@ -105,22 +104,16 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
} while (still_pending_size > 0);
encrypted_leftover = grpc_slice_from_copied_buffer(
(const char *)encrypted_buffer, total_buffer_size - buffer_size);
- f.client_ep =
- use_zero_copy_protector
- ? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector,
- tcp.client, &encrypted_leftover, 1)
- : grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client,
- &encrypted_leftover, 1);
+ f.client_ep = grpc_secure_endpoint_create(
+ fake_read_protector, fake_read_zero_copy_protector, tcp.client,
+ &encrypted_leftover, 1);
grpc_slice_unref(encrypted_leftover);
gpr_free(encrypted_buffer);
}
- f.server_ep =
- use_zero_copy_protector
- ? grpc_secure_endpoint_create(NULL, fake_write_zero_copy_protector,
- tcp.server, NULL, 0)
- : grpc_secure_endpoint_create(fake_write_protector, NULL, tcp.server,
- NULL, 0);
+ f.server_ep = grpc_secure_endpoint_create(fake_write_protector,
+ fake_write_zero_copy_protector,
+ tcp.server, NULL, 0);
grpc_exec_ctx_finish(&exec_ctx);
return f;
}