mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 545457 - Get http-state tests running as unit tests.
This commit is contained in:
parent
c1d5efa1f1
commit
0a2cafdfae
@ -69,6 +69,7 @@ CPPSRCS = \
|
||||
nsCookieService.cpp \
|
||||
$(NULL)
|
||||
|
||||
XPCSHELL_TESTS += test/unit
|
||||
|
||||
ifdef MOZ_IPC
|
||||
EXPORTS_NAMESPACES = mozilla/net
|
||||
|
18
netwerk/cookie/test/unit/test_parser_0001.js
Normal file
18
netwerk/cookie/test/unit/test_parser_0001.js
Normal file
@ -0,0 +1,18 @@
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
function run_test() {
|
||||
let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
|
||||
|
||||
let uri = NetUtil.newURI("http://example.org/");
|
||||
|
||||
let set = "foo=bar";
|
||||
cs.setCookieStringFromHttp(uri, null, null, set, null, null);
|
||||
|
||||
let expected = "foo=bar";
|
||||
let actual = cs.getCookieStringFromHttp(uri, null, null);
|
||||
do_check_eq(actual, expected);
|
||||
}
|
||||
|
18
netwerk/cookie/test/unit/test_parser_0019.js
Normal file
18
netwerk/cookie/test/unit/test_parser_0019.js
Normal file
@ -0,0 +1,18 @@
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
function run_test() {
|
||||
let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
|
||||
|
||||
let uri = NetUtil.newURI("http://example.org/");
|
||||
|
||||
let set = "foo=b;max-age=3600, c=d;path=/";
|
||||
cs.setCookieStringFromHttp(uri, null, null, set, null, null);
|
||||
|
||||
let expected = "foo=b";
|
||||
let actual = cs.getCookieStringFromHttp(uri, null, null);
|
||||
do_check_eq(actual, expected);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user