aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/client_channel/uri_parser_test.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:05:05 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:05:05 -0800
commitad4d2dde0052efbbf49d64b0843c45f0381cfeb3 (patch)
tree6a657f8c6179d873b34505cdc24bce9462ca68eb /test/core/client_channel/uri_parser_test.cc
parenta3df36cc2505a89c2f481eea4a66a87b3002844a (diff)
Revert "All instances of exec_ctx being passed around in src/core removed"
Diffstat (limited to 'test/core/client_channel/uri_parser_test.cc')
-rw-r--r--test/core/client_channel/uri_parser_test.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/test/core/client_channel/uri_parser_test.cc b/test/core/client_channel/uri_parser_test.cc
index 254bfddfb3..30183f9f57 100644
--- a/test/core/client_channel/uri_parser_test.cc
+++ b/test/core/client_channel/uri_parser_test.cc
@@ -20,7 +20,6 @@
#include <string.h>
-#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -29,28 +28,29 @@
static void test_succeeds(const char* uri_text, const char* scheme,
const char* authority, const char* path,
const char* query, const char* fragment) {
- grpc_core::ExecCtx exec_ctx;
- grpc_uri* uri = grpc_uri_parse(uri_text, 0);
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp(scheme, uri->scheme));
GPR_ASSERT(0 == strcmp(authority, uri->authority));
GPR_ASSERT(0 == strcmp(path, uri->path));
GPR_ASSERT(0 == strcmp(query, uri->query));
GPR_ASSERT(0 == strcmp(fragment, uri->fragment));
-
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_uri_destroy(uri);
}
static void test_fails(const char* uri_text) {
- grpc_core::ExecCtx exec_ctx;
- GPR_ASSERT(nullptr == grpc_uri_parse(uri_text, 0));
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ GPR_ASSERT(nullptr == grpc_uri_parse(&exec_ctx, uri_text, 0));
+ grpc_exec_ctx_finish(&exec_ctx);
}
static void test_query_parts() {
{
- grpc_core::ExecCtx exec_ctx;
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
const char* uri_text = "http://foo/path?a&b=B&c=&#frag";
- grpc_uri* uri = grpc_uri_parse(uri_text, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -77,14 +77,14 @@ static void test_query_parts() {
GPR_ASSERT(nullptr == grpc_uri_get_query_arg(uri, ""));
GPR_ASSERT(0 == strcmp("frag", uri->fragment));
-
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_uri_destroy(uri);
}
{
/* test the current behavior of multiple query part values */
- grpc_core::ExecCtx exec_ctx;
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
const char* uri_text = "http://auth/path?foo=bar=baz&foobar==";
- grpc_uri* uri = grpc_uri_parse(uri_text, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -96,13 +96,14 @@ static void test_query_parts() {
GPR_ASSERT(0 == strcmp("bar", grpc_uri_get_query_arg(uri, "foo")));
GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "foobar")));
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_uri_destroy(uri);
}
{
/* empty query */
- grpc_core::ExecCtx exec_ctx;
+ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
const char* uri_text = "http://foo/path";
- grpc_uri* uri = grpc_uri_parse(uri_text, 0);
+ grpc_uri* uri = grpc_uri_parse(&exec_ctx, uri_text, 0);
GPR_ASSERT(uri);
GPR_ASSERT(0 == strcmp("http", uri->scheme));
@@ -113,14 +114,13 @@ static void test_query_parts() {
GPR_ASSERT(nullptr == uri->query_parts);
GPR_ASSERT(nullptr == uri->query_parts_values);
GPR_ASSERT(0 == strcmp("", uri->fragment));
-
+ grpc_exec_ctx_finish(&exec_ctx);
grpc_uri_destroy(uri);
}
}
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
- grpc_init();
test_succeeds("http://www.google.com", "http", "www.google.com", "", "", "");
test_succeeds("dns:///foo", "dns", "", "/foo", "", "");
test_succeeds("http://www.google.com:90", "http", "www.google.com:90", "", "",
@@ -148,6 +148,5 @@ int main(int argc, char** argv) {
test_fails("http://foo?bar#lol#");
test_query_parts();
- grpc_shutdown();
return 0;
}