aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/security/json_token_test.cc
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-12-08 13:03:05 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-12-08 13:56:39 -0800
commit280281fd4dcef2f4958185cd73b62d70df6f1767 (patch)
tree32c4c152bbf61e64f9946cb2a316af90124fcd3a /test/core/security/json_token_test.cc
parenta77fb7dc6792a48edc30100482032844c56feedc (diff)
parent94e676e10f8c739289924b8458a246699e3623ce (diff)
Merge branch 'master' of https://github.com/grpc/grpc into flow-control-part4
Diffstat (limited to 'test/core/security/json_token_test.cc')
-rw-r--r--test/core/security/json_token_test.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc
index 0b6ccd5e37..aac9cc0029 100644
--- a/test/core/security/json_token_test.cc
+++ b/test/core/security/json_token_test.cc
@@ -207,7 +207,7 @@ static void test_parse_json_key_failure_no_private_key(void) {
static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
char** scratchpad) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
char* b64;
char* decoded;
grpc_json* json;
@@ -215,7 +215,7 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
b64 = static_cast<char*>(gpr_malloc(len + 1));
strncpy(b64, str, len);
b64[len] = '\0';
- slice = grpc_base64_decode(&exec_ctx, b64, 1);
+ slice = grpc_base64_decode(b64, 1);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(slice));
decoded = static_cast<char*>(gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1));
strncpy(decoded, (const char*)GRPC_SLICE_START_PTR(slice),
@@ -225,7 +225,7 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
gpr_free(b64);
*scratchpad = decoded;
grpc_slice_unref(slice);
- grpc_exec_ctx_finish(&exec_ctx);
+
return json;
}
@@ -327,12 +327,12 @@ static void check_jwt_claim(grpc_json* claim, const char* expected_audience,
static void check_jwt_signature(const char* b64_signature, RSA* rsa_key,
const char* signed_data,
size_t signed_data_size) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
EVP_MD_CTX* md_ctx = EVP_MD_CTX_create();
EVP_PKEY* key = EVP_PKEY_new();
- grpc_slice sig = grpc_base64_decode(&exec_ctx, b64_signature, 1);
+ grpc_slice sig = grpc_base64_decode(b64_signature, 1);
GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
GPR_ASSERT(GRPC_SLICE_LENGTH(sig) == 128);
@@ -347,11 +347,9 @@ static void check_jwt_signature(const char* b64_signature, RSA* rsa_key,
GPR_ASSERT(EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(sig),
GRPC_SLICE_LENGTH(sig)) == 1);
- grpc_slice_unref_internal(&exec_ctx, sig);
+ grpc_slice_unref_internal(sig);
if (key != nullptr) EVP_PKEY_free(key);
if (md_ctx != nullptr) EVP_MD_CTX_destroy(md_ctx);
-
- grpc_exec_ctx_finish(&exec_ctx);
}
static char* service_account_creds_jwt_encode_and_sign(
@@ -485,6 +483,7 @@ static void test_parse_refresh_token_failure_no_refresh_token(void) {
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
+ grpc_init();
test_parse_json_key_success();
test_parse_json_key_failure_bad_json();
test_parse_json_key_failure_no_type();
@@ -499,5 +498,6 @@ int main(int argc, char** argv) {
test_parse_refresh_token_failure_no_client_id();
test_parse_refresh_token_failure_no_client_secret();
test_parse_refresh_token_failure_no_refresh_token();
+ grpc_shutdown();
return 0;
}