Bug 545457 - Get http-state tests running as unit tests.

This commit is contained in:
Dan Witte 2010-06-29 14:20:38 -07:00
parent c1d5efa1f1
commit 0a2cafdfae
3 changed files with 37 additions and 0 deletions

View File

@ -69,6 +69,7 @@ CPPSRCS = \
nsCookieService.cpp \
$(NULL)
XPCSHELL_TESTS += test/unit
ifdef MOZ_IPC
EXPORTS_NAMESPACES = mozilla/net

View 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);
}

View 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);
}