[vlc-commits] https: revector HTTP/2 connection test

Rémi Denis-Courmont git at videolan.org
Fri Dec 18 21:07:44 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Dec 18 19:02:54 2015 +0200| [9889e17c0fd139e0792cca1cb7d55424b6048ad3] | committer: Rémi Denis-Courmont

https: revector HTTP/2 connection test

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9889e17c0fd139e0792cca1cb7d55424b6048ad3
---

 modules/access/http/Makefile.am   |    9 ++-------
 modules/access/http/h2conn_test.c |   33 ++++++---------------------------
 2 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/modules/access/http/Makefile.am b/modules/access/http/Makefile.am
index 7c8b4b7..2ebe78f 100644
--- a/modules/access/http/Makefile.am
+++ b/modules/access/http/Makefile.am
@@ -30,13 +30,8 @@ h2frame_test_SOURCES = access/http/h2frame_test.c \
 	access/http/h2frame.c access/http/h2frame.h
 h2output_test_SOURCES = access/http/h2output_test.c
 h2output_test_LDADD = libvlc_http.la $(LIBPTHREAD)
-h2conn_test_SOURCES = access/http/h2conn_test.c \
-	access/http/message.c access/http/message.h \
-	access/http/hpack.c access/http/hpack.h access/http/hpackenc.c \
-	access/http/h2frame.c access/http/h2frame.h \
-	access/http/h2conn.c access/http/h2conn.h \
-	access/http/h2output.c access/http/h2output.h
-h2conn_test_LDADD = $(LIBPTHREAD)
+h2conn_test_SOURCES = access/http/h2conn_test.c
+h2conn_test_LDADD = libvlc_http.la $(LIBPTHREAD)
 http_msg_test_SOURCES = access/http/message_test.c \
 	access/http/message.c access/http/message.h
 http_file_test_SOURCES = access/http/file_test.c \
diff --git a/modules/access/http/h2conn_test.c b/modules/access/http/h2conn_test.c
index 5bd2a8e..fec5fcc 100644
--- a/modules/access/http/h2conn_test.c
+++ b/modules/access/http/h2conn_test.c
@@ -42,31 +42,6 @@
 #include "message.h"
 #include "transport.h"
 
-/* I/O callbacks */
-static int internal_fd = -1;
-
-static vlc_tls_t fake_tls;
-
-ssize_t vlc_https_send(struct vlc_tls *tls, const void *buf, size_t len)
-{
-    assert(tls == &fake_tls);
-    (void) buf;
-    return len;
-}
-
-ssize_t vlc_https_recv(struct vlc_tls *tls, void *buf, size_t size)
-{
-    assert(tls == &fake_tls);
-    return read(internal_fd, buf, size);
-}
-
-void vlc_https_disconnect(struct vlc_tls *tls)
-{
-    assert(tls == &fake_tls);
-    if (close(internal_fd))
-        assert(!"close");
-}
-
 static struct vlc_h2_conn *conn;
 static int external_fd;
 
@@ -87,10 +62,12 @@ static void conn_create(void)
     if (socketpair(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, fds))
         assert(!"socketpair");
 
+    struct vlc_tls *tls = vlc_tls_DummyCreate(NULL, fds[1]);
+    assert(tls != NULL);
+
     external_fd = fds[0];
-    internal_fd = fds[1];
 
-    conn = vlc_h2_conn_create(&fake_tls);
+    conn = vlc_h2_conn_create(tls);
     assert(conn != NULL);
     conn_send(vlc_h2_frame_settings());
 }
@@ -137,6 +114,8 @@ static void stream_data(uint_fast32_t id, const char *str, bool eos)
     conn_send(vlc_h2_frame_data(id, str, strlen(str), eos));
 }
 
+/* TODO: check messages coming from the connection under test */
+
 int main(void)
 {
     struct vlc_http_stream *s, *s2;



More information about the vlc-commits mailing list