mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1210302 - Part 5: Add a unit test for parseRequestContentType; r=mcmanus
This commit is contained in:
parent
a2fcdab18e
commit
6ea5bf1aeb
@ -25,81 +25,162 @@ function run_test() {
|
||||
var netutil = Components.classes["@mozilla.org/network/util;1"]
|
||||
.getService(Components.interfaces.nsINetUtil);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType("TEXT/HTML", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("TEXT/HTML", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html, text/html", charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html, text/html", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html, text/plain",
|
||||
charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html, text/plain",
|
||||
charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/html, ', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/html, ', charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/html, */*', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/html, */*', charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/html, foo', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/html, foo', charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset=ISO-8859-1",
|
||||
charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset=ISO-8859-1",
|
||||
charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType('text/html; charset="ISO-8859-1"',
|
||||
charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseResponseContentType('text/html; charset="ISO-8859-1"',
|
||||
charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset='ISO-8859-1'",
|
||||
charset, hadCharset);
|
||||
check("text/html", "'ISO-8859-1'", true);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset='ISO-8859-1'",
|
||||
charset, hadCharset);
|
||||
check("text/html", "'ISO-8859-1'", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset=\"ISO-8859-1\", text/html",
|
||||
charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset=\"ISO-8859-1\", text/html",
|
||||
charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset=\"ISO-8859-1\", text/html; charset=UTF8",
|
||||
charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset=\"ISO-8859-1\", text/html; charset=UTF8",
|
||||
charset, hadCharset);
|
||||
check("text/html", "UTF8", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset=ISO-8859-1, TEXT/HTML", charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset=ISO-8859-1, TEXT/HTML", charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/html; charset=ISO-8859-1, TEXT/plain", charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/html; charset=ISO-8859-1, TEXT/plain", charset, hadCharset);
|
||||
check("text/plain", "", true);
|
||||
|
||||
type = netutil.parseRequestContentType("text/plain, TEXT/HTML; charset=ISO-8859-1, text/html, TEXT/HTML", charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/plain, TEXT/HTML; charset=ISO-8859-1, text/html, TEXT/HTML", charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain, TEXT/HTML; param="charset=UTF8"; charset="ISO-8859-1"; param2="charset=UTF16", text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain, TEXT/HTML; param="charset=UTF8"; charset="ISO-8859-1"; param2="charset=UTF16", text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain, TEXT/HTML; param=charset=UTF8; charset="ISO-8859-1"; param2=charset=UTF16, text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain, TEXT/HTML; param=charset=UTF8; charset="ISO-8859-1"; param2=charset=UTF16, text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("text/html", "ISO-8859-1", true);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain, TEXT/HTML; param=charset=UTF8; charset="ISO-8859-1"; param2=charset=UTF16, text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType("text/plain; param= , text/html", charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType("text/plain; param= , text/html", charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain; param=", text/html"', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain; param=", text/html"', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain; param=", \\" , text/html"', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain; param=", \\" , text/html"', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain; param=", \\" , text/html , "', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain; param=", \\" , text/html , "', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain param=", \\" , text/html , "', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain param=", \\" , text/html , "', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain charset=UTF8', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain charset=UTF8', charset, hadCharset);
|
||||
check("text/plain", "", false);
|
||||
|
||||
type = netutil.parseRequestContentType('text/plain, TEXT/HTML; param="charset=UTF8"; ; param2="charset=UTF16", text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("", "", false);
|
||||
|
||||
type = netutil.parseResponseContentType('text/plain, TEXT/HTML; param="charset=UTF8"; ; param2="charset=UTF16", text/html, TEXT/HTML', charset, hadCharset);
|
||||
check("text/html", "", false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user