[vlc-commits] https: add some file test cases
Rémi Denis-Courmont
git at videolan.org
Sat Dec 19 19:12:25 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Dec 19 20:07:37 2015 +0200| [381f7a665ffc65f51356c80226f7a708d8a59f74] | committer: Rémi Denis-Courmont
https: add some file test cases
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=381f7a665ffc65f51356c80226f7a708d8a59f74
---
modules/access/http/file_test.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/modules/access/http/file_test.c b/modules/access/http/file_test.c
index 1699aec..d3e347d 100644
--- a/modules/access/http/file_test.c
+++ b/modules/access/http/file_test.c
@@ -165,10 +165,45 @@ int main(void)
assert(vlc_http_file_seek(f, offset = 1234) == 0);
vlc_http_file_destroy(f);
+ /* Invalid responses */
+ replies[0] = "HTTP/1.1 206 Partial Content\r\n"
+ "Content-Type: multipart/byteranges\r\n"
+ "\r\n";
+ offset = 0;
+
+ f = vlc_http_file_create(NULL, url, ua, NULL);
+ assert(f != NULL);
+ assert(vlc_http_file_get_size(f) == (uintmax_t)-1);
+
+ replies[0] = "HTTP/1.1 206 Partial Content\r\n"
+ "Content-Range: seconds 60-120/180\r\n"
+ "\r\n";
+ assert(vlc_http_file_seek(f, 0) == -1);
+
+ /* Incomplete range */
+ replies[0] = "HTTP/1.1 206 Partial Content\r\n"
+ "Content-Range: bytes 0-1233/*\r\n"
+ "\r\n";
+ assert(vlc_http_file_seek(f, 0) == 0);
+ assert(vlc_http_file_get_size(f) == 1234);
+
+ /* Extraneous range */
+ replies[0] = "HTTP/1.1 200 OK\r\n"
+ "Content-Range: bytes 0-1233/1234\r\n"
+ "\r\n";
+ assert(vlc_http_file_seek(f, 0) == 0);
+ assert(vlc_http_file_get_size(f) == (uintmax_t)-1);
+
+ vlc_http_file_destroy(f);
/* Dummy API calls */
f = vlc_http_file_create(NULL, "ftp://localhost/foo", NULL, NULL);
assert(f == NULL);
+ f = vlc_http_file_create(NULL, "/foo", NULL, NULL);
+ assert(f == NULL);
+ f = vlc_http_file_create(NULL, "http://www.example.com", NULL, NULL);
+ assert(f != NULL);
+ vlc_http_file_destroy(f);
return 0;
}
More information about the vlc-commits
mailing list