aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/handshake
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-10-23 15:33:21 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2017-10-25 16:23:01 -0700
commit34a57d0346afe95e11104462c30dc468b0cb0b89 (patch)
tree67db15f7b8b361e0618199dc55215f3b4d626201 /test/core/handshake
parentc563b583cb9b7fecc33971581368796d2df4759d (diff)
rename all test core files to cc and a lot of C++ style conversions
Diffstat (limited to 'test/core/handshake')
-rw-r--r--test/core/handshake/client_ssl.cc (renamed from test/core/handshake/client_ssl.c)16
-rw-r--r--test/core/handshake/server_ssl.cc (renamed from test/core/handshake/server_ssl.c)3
2 files changed, 10 insertions, 9 deletions
diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.cc
index de660fe1c4..f501948b96 100644
--- a/test/core/handshake/client_ssl.c
+++ b/test/core/handshake/client_ssl.cc
@@ -230,8 +230,7 @@ static bool client_ssl_test(char *server_alpn_preferred) {
gpr_thd_options thdopt = gpr_thd_options_default();
gpr_thd_id thdid;
gpr_thd_options_set_joinable(&thdopt);
- server_args args = {.socket = server_socket,
- .alpn_preferred = server_alpn_preferred};
+ server_args args = {server_socket, server_alpn_preferred};
GPR_ASSERT(gpr_thd_new(&thdid, server_thread, &args, &thdopt));
// Load key pair and establish client SSL credentials.
@@ -253,9 +252,10 @@ static bool client_ssl_test(char *server_alpn_preferred) {
// lazy, this won't necessarily establish a connection yet.
char *target;
gpr_asprintf(&target, "127.0.0.1:%d", port);
- grpc_arg ssl_name_override = {GRPC_ARG_STRING,
- GRPC_SSL_TARGET_NAME_OVERRIDE_ARG,
- {"foo.test.google.fr"}};
+ grpc_arg ssl_name_override = {
+ GRPC_ARG_STRING,
+ const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
+ {const_cast<char *>("foo.test.google.fr")}};
grpc_channel_args grpc_args;
grpc_args.num_args = 1;
grpc_args.args = &ssl_name_override;
@@ -305,14 +305,14 @@ static bool client_ssl_test(char *server_alpn_preferred) {
int main(int argc, char *argv[]) {
// Handshake succeeeds when the server has grpc-exp as the ALPN preference.
- GPR_ASSERT(client_ssl_test("grpc-exp"));
+ GPR_ASSERT(client_ssl_test(const_cast<char *>("grpc-exp")));
// Handshake succeeeds when the server has h2 as the ALPN preference. This
// covers legacy gRPC servers which don't support grpc-exp.
- GPR_ASSERT(client_ssl_test("h2"));
+ GPR_ASSERT(client_ssl_test(const_cast<char *>("h2")));
// Handshake fails when the server uses a fake protocol as its ALPN
// preference. This validates the client is correctly validating ALPN returns
// and sanity checks the client_ssl_test.
- GPR_ASSERT(!client_ssl_test("foo"));
+ GPR_ASSERT(!client_ssl_test(const_cast<char *>("foo")));
return 0;
}
diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.cc
index 85a8b4de41..7b24459688 100644
--- a/test/core/handshake/server_ssl.c
+++ b/test/core/handshake/server_ssl.cc
@@ -175,7 +175,8 @@ static bool server_ssl_test(const char *alpn_list[], unsigned int alpn_list_len,
for (unsigned int i = 0; i < alpn_list_len; ++i) {
alpn_protos_len += (unsigned int)strlen(alpn_list[i]);
}
- unsigned char *alpn_protos = gpr_malloc(alpn_protos_len);
+ unsigned char *alpn_protos =
+ static_cast<unsigned char *>(gpr_malloc(alpn_protos_len));
unsigned char *p = alpn_protos;
for (unsigned int i = 0; i < alpn_list_len; ++i) {
const uint8_t len = (uint8_t)strlen(alpn_list[i]);