diff options
author | Mark D. Roth <roth@google.com> | 2017-02-02 09:04:02 -0800 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2017-02-02 09:04:02 -0800 |
commit | 6e6c7b5b93ad9c234470cdfac61878671cf9d984 (patch) | |
tree | f99027c406bd178187035ad0d37620ee7df216be /test | |
parent | e003dd9768f4d3a1ff8c8ea4a76a284e31056bbf (diff) |
Fix secure_channel_create_test.
Diffstat (limited to 'test')
-rw-r--r-- | test/core/surface/secure_channel_create_test.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.c index ab4067dbe1..f1d9a75f11 100644 --- a/test/core/surface/secure_channel_create_test.c +++ b/test/core/surface/secure_channel_create_test.c @@ -43,45 +43,44 @@ #include "test/core/util/test_config.h" void test_unknown_scheme_target(void) { - grpc_channel *chan; - grpc_channel_credentials *creds; grpc_resolver_registry_shutdown(); grpc_resolver_registry_init(); - - creds = grpc_fake_transport_security_credentials_create(); - chan = grpc_secure_channel_create(creds, "blah://blah", NULL, NULL); - GPR_ASSERT(chan == NULL); + grpc_channel_credentials *creds = + grpc_fake_transport_security_credentials_create(); + grpc_channel *chan = grpc_secure_channel_create(creds, "blah://blah", NULL, + NULL); + grpc_channel_element *elem = + grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); + GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test"); grpc_channel_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); } void test_security_connector_already_in_arg(void) { - grpc_channel *chan; - grpc_channel_element *elem; - grpc_channel_args args; grpc_arg arg; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - arg.type = GRPC_ARG_POINTER; arg.value.pointer.p = NULL; arg.key = GRPC_SECURITY_CONNECTOR_ARG; + grpc_channel_args args; args.num_args = 1; args.args = &arg; - chan = grpc_secure_channel_create(NULL, NULL, &args, NULL); - elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); + grpc_channel *chan = grpc_secure_channel_create(NULL, NULL, &args, NULL); + grpc_channel_element *elem = + grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test"); grpc_exec_ctx_finish(&exec_ctx); } void test_null_creds(void) { - grpc_channel *chan; - grpc_channel_element *elem; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - chan = grpc_secure_channel_create(NULL, NULL, NULL, NULL); - elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); + grpc_channel *chan = grpc_secure_channel_create(NULL, NULL, NULL, NULL); + grpc_channel_element *elem = + grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, chan, "test"); grpc_exec_ctx_finish(&exec_ctx); } |