aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/http
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-10-26 16:16:06 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-10-26 16:16:06 -0700
commitd41a4a720f76c6555b80f82ee771071e09d55e03 (patch)
tree1ca017c927b7b3f80204ecc362c22468d3775887 /test/core/http
parent6b5d682c981f365d1f3c1bf771f113bd727d5ee0 (diff)
s/gpr_slice/grpc_slice, and move around tests, impls
Diffstat (limited to 'test/core/http')
-rw-r--r--test/core/http/format_request_test.c24
-rw-r--r--test/core/http/parser_test.c32
-rw-r--r--test/core/http/request_fuzzer.c4
-rw-r--r--test/core/http/response_fuzzer.c4
4 files changed, 32 insertions, 32 deletions
diff --git a/test/core/http/format_request_test.c b/test/core/http/format_request_test.c
index 0d21e1200b..bd31e5e8ab 100644
--- a/test/core/http/format_request_test.c
+++ b/test/core/http/format_request_test.c
@@ -41,7 +41,7 @@
static void test_format_get_request(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
@@ -51,7 +51,7 @@ static void test_format_get_request(void) {
slice = grpc_httpcli_format_get_request(&req);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"GET /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
@@ -60,13 +60,13 @@ static void test_format_get_request(void) {
"x-yz: abc\r\n"
"\r\n"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_format_post_request(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
char body_bytes[] = "fake body";
size_t body_len = 9;
@@ -78,7 +78,7 @@ static void test_format_post_request(void) {
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
@@ -90,13 +90,13 @@ static void test_format_post_request(void) {
"\r\n"
"fake body"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_format_post_request_no_body(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
@@ -106,7 +106,7 @@ static void test_format_post_request_no_body(void) {
slice = grpc_httpcli_format_post_request(&req, NULL, 0);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
"Connection: close\r\n"
@@ -115,13 +115,13 @@ static void test_format_post_request_no_body(void) {
"x-yz: abc\r\n"
"\r\n"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_format_post_request_content_type_override(void) {
grpc_http_header hdrs[2];
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
char body_bytes[] = "fake%20body";
size_t body_len = 11;
@@ -137,7 +137,7 @@ static void test_format_post_request_content_type_override(void) {
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
- GPR_ASSERT(0 == gpr_slice_str_cmp(
+ GPR_ASSERT(0 == grpc_slice_str_cmp(
slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
@@ -149,7 +149,7 @@ static void test_format_post_request_content_type_override(void) {
"\r\n"
"fake%20body"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
int main(int argc, char **argv) {
diff --git a/test/core/http/parser_test.c b/test/core/http/parser_test.c
index 2fc354d9ee..4f1445d3f1 100644
--- a/test/core/http/parser_test.c
+++ b/test/core/http/parser_test.c
@@ -48,23 +48,23 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode,
grpc_http_version expect_version,
char *expect_path, char *expect_body, ...) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(request_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
va_list args;
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) ==
GRPC_ERROR_NONE);
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_http_parser_eof(&parser) == GRPC_ERROR_NONE);
@@ -105,23 +105,23 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode,
static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text,
int expect_status, char *expect_body, ...) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(response_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
va_list args;
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) ==
GRPC_ERROR_NONE);
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_http_parser_eof(&parser) == GRPC_ERROR_NONE);
@@ -158,16 +158,16 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text,
static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(response_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
grpc_error *error = GRPC_ERROR_NONE;
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
@@ -175,7 +175,7 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
if (GRPC_ERROR_NONE == error) {
error = grpc_http_parser_parse(&parser, slices[i], NULL);
}
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
if (GRPC_ERROR_NONE == error) {
error = grpc_http_parser_eof(&parser);
@@ -191,16 +191,16 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
static void test_request_fails(grpc_slice_split_mode split_mode,
char *request_text) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(request_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
grpc_error *error = GRPC_ERROR_NONE;
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
@@ -208,7 +208,7 @@ static void test_request_fails(grpc_slice_split_mode split_mode,
if (error == GRPC_ERROR_NONE) {
error = grpc_http_parser_parse(&parser, slices[i], NULL);
}
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
if (error == GRPC_ERROR_NONE) {
error = grpc_http_parser_eof(&parser);
diff --git a/test/core/http/request_fuzzer.c b/test/core/http/request_fuzzer.c
index bb6cb92c0c..98e2c9680d 100644
--- a/test/core/http/request_fuzzer.c
+++ b/test/core/http/request_fuzzer.c
@@ -47,10 +47,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL));
GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_http_parser_destroy(&parser);
grpc_http_request_destroy(&request);
return 0;
diff --git a/test/core/http/response_fuzzer.c b/test/core/http/response_fuzzer.c
index 4393840484..fff04117b2 100644
--- a/test/core/http/response_fuzzer.c
+++ b/test/core/http/response_fuzzer.c
@@ -46,10 +46,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL));
GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_http_parser_destroy(&parser);
grpc_http_response_destroy(&response);
return 0;