diff options
| author | Haibo Huang <hhb@google.com> | 2019-05-31 16:12:39 -0700 |
|---|---|---|
| committer | Haibo Huang <hhb@google.com> | 2019-06-18 14:58:09 -0700 |
| commit | b22796788b72b1daca42bf5773b582d26860ef0a (patch) | |
| tree | 1d148d55162d1d29b1bc55ea05ff62c1793086d6 /test/regress_rpc.c | |
| parent | eb295e03887a843c88bcef99c80c16dd8c13099a (diff) | |
| download | platform_external_libevent-b22796788b72b1daca42bf5773b582d26860ef0a.tar.gz platform_external_libevent-b22796788b72b1daca42bf5773b582d26860ef0a.tar.bz2 platform_external_libevent-b22796788b72b1daca42bf5773b582d26860ef0a.zip | |
Upgrade libevent to release-2.1.10-stableandroid-o-mr1-iot-release-1.0.14
Test: None
Change-Id: I24e4275a07a6dcdd932056c7893a6aabdd786b8a
Diffstat (limited to 'test/regress_rpc.c')
| -rw-r--r-- | test/regress_rpc.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/test/regress_rpc.c b/test/regress_rpc.c index 01a058c..87a7efa 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -61,7 +61,6 @@ #include "event2/http_compat.h" #include "event2/http_struct.h" #include "event2/rpc.h" -#include "event2/rpc.h" #include "event2/rpc_struct.h" #include "event2/tag.h" #include "log-internal.h" @@ -880,6 +879,53 @@ end: evbuffer_free(tmp); } +static void +rpc_invalid_type(void) +{ + ev_uint16_t port; + struct evhttp *http = NULL; + struct evrpc_base *base = NULL; + struct evhttp_connection *evcon = NULL; + struct evhttp_request *req = NULL; + + rpc_setup(&http, &port, &base); + + evcon = evhttp_connection_new("127.0.0.1", port); + tt_assert(evcon); + + /* + * At this point, we want to schedule an HTTP POST request + * server using our make request method. + */ + + req = evhttp_request_new(rpc_postrequest_failure, NULL); + tt_assert(req); + + /* Add the information that we care about */ + evhttp_add_header(req->output_headers, "Host", "somehost"); + evbuffer_add_printf(req->output_buffer, "Some Nonsense"); + + if (evhttp_make_request(evcon, req, + EVHTTP_REQ_GET, + "/.rpc.Message") == -1) { + tt_abort(); + } + + test_ok = 0; + + event_dispatch(); + + evhttp_connection_free(evcon); + + rpc_teardown(base); + + tt_assert(test_ok == 1); + +end: + evhttp_free(http); +} + + #define RPC_LEGACY(name) \ { #name, run_legacy_test_fn, TT_FORK|TT_NEED_BASE|TT_LEGACY, \ &legacy_setup, \ @@ -898,6 +944,7 @@ struct testcase_t rpc_testcases[] = { RPC_LEGACY(basic_client), RPC_LEGACY(basic_queued_client), RPC_LEGACY(basic_client_with_pause), + RPC_LEGACY(invalid_type), RPC_LEGACY(client_timeout), RPC_LEGACY(test), |
