From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../third_party/libevent/test-export/test-export.c | 122 +++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 ipc/chromium/src/third_party/libevent/test-export/test-export.c (limited to 'ipc/chromium/src/third_party/libevent/test-export/test-export.c') diff --git a/ipc/chromium/src/third_party/libevent/test-export/test-export.c b/ipc/chromium/src/third_party/libevent/test-export/test-export.c new file mode 100644 index 0000000000..9091777554 --- /dev/null +++ b/ipc/chromium/src/third_party/libevent/test-export/test-export.c @@ -0,0 +1,122 @@ +#include +#if defined(EVENT_EXPORT_TEST_COMPONENT_EXTRA) +#include "event2/http.h" +#include "event2/rpc.h" +#include +#elif defined(EVENT_EXPORT_TEST_COMPONENT_PTHREADS) +#include +#elif defined(EVENT_EXPORT_TEST_COMPONENT_OPENSSL) +#include +#include +#include +#endif + +#if defined(EVENT_EXPORT_TEST_COMPONENT_EXTRA) +static int +test() +{ + struct event_base *base = NULL; + struct evhttp *http = NULL; + struct evdns_base *dns_base = NULL; + struct evrpc_base *rpc_base = NULL; + + base = event_base_new(); + if (base) { + http = evhttp_new(base); + dns_base = evdns_base_new(base, + EVDNS_BASE_DISABLE_WHEN_INACTIVE); + } + if (http) + rpc_base = evrpc_init(http); + + if (base) + event_base_free(base); + if (http) + evhttp_free(http); + if (rpc_base) + evrpc_free(rpc_base); + if (dns_base) + evdns_base_free(dns_base, 0); + + return 0; +} +#elif defined(EVENT_EXPORT_TEST_COMPONENT_PTHREADS) +static int +test() +{ + return evthread_use_pthreads(); +} +#elif defined(EVENT_EXPORT_TEST_COMPONENT_OPENSSL) +static int +test() +{ + struct event_base *base = NULL; + SSL_CTX *ssl_ctx = NULL; + SSL *ssl = NULL; + struct bufferevent *bev; + int r = 1; + + SSL_library_init(); + ERR_load_crypto_strings(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + + base = event_base_new(); + if (!base) { + goto error; + } + + ssl_ctx = SSL_CTX_new(SSLv23_method()); + if (!ssl_ctx) { + goto error; + } + ssl = SSL_new(ssl_ctx); + if (ssl == NULL) { + goto error; + } + bev = bufferevent_openssl_socket_new(base, -1, ssl, + BUFFEREVENT_SSL_CONNECTING, + BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS); + if (bev == NULL) { + goto error; + } + r = 0; +error: + if (base) + event_base_free(base); + if (ssl_ctx) + SSL_CTX_free(ssl_ctx); + if (ssl) + SSL_free(ssl); + return r; +} +#else +static int +test() +{ + struct event_base *base = NULL; + + base = event_base_new(); + if (base) + event_base_free(base); + + return 0; +} +#endif + +int +main(int argc, char const *argv[]) +{ + int r = 0; +#ifdef _WIN32 + { + WSADATA wsaData; + WSAStartup(MAKEWORD(2, 2), &wsaData); + } +#endif + r = test(); +#ifdef _WIN32 + WSACleanup(); +#endif + return r; +} -- cgit v1.2.3