B2G/gecko/browser/components/preferences/tests/browser_bug705422.js
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
function test() {
    waitForExplicitFinish();
    const searchTerm = "example";
    const dummyTerm = "elpmaxe";
    var cm =  Components.classes["@mozilla.org/cookiemanager;1"]
                        .getService(Components.interfaces.nsICookieManager);
    cm.removeAll();
    var vals = [[searchTerm+".com", dummyTerm, dummyTerm],          
                [searchTerm+".org", dummyTerm, dummyTerm],          
                [dummyTerm+".com", searchTerm, dummyTerm],          
                [dummyTerm+".edu", searchTerm+dummyTerm, dummyTerm],
                [dummyTerm+".net", dummyTerm, searchTerm],          
                [dummyTerm+".org", dummyTerm, searchTerm+dummyTerm],
                [dummyTerm+".int", dummyTerm, dummyTerm]];          
    es must correspond to above data
    const matches = 6;
    var ios = Components.classes["@mozilla.org/network/io-service;1"]
                        .getService(Components.interfaces.nsIIOService);
    var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
                              .getService(Components.interfaces.nsICookieService);
    var v;
    for (v in vals) {
        let [host, name, value] = vals[v];    
        var cookieUri = ios.newURI("http://"+host, null, null);
        cookieSvc.setCookieString(cookieUri, null, name+"="+value+";", null);
    }
    var cmd = window.openDialog("chrome://browser/content/preferences/cookies.xul",
                                "Browser:Cookies", "", {});
    cmd.addEventListener("load", function() {executeSoon(function() {runTest(cmd, searchTerm, vals.length, matches);});}, false);
}
function test ( ) { waitForExplicitFinish ( ) ; const searchTerm = "example" ; const dummyTerm = "elpmaxe" ; var cm = Components . classes [ "@mozilla.org/cookiemanager;1" ] . getService ( Components . interfaces . nsICookieManager ) ; cm . removeAll ( ) ; var vals = [ [ searchTerm + ".com" , dummyTerm , dummyTerm ] , [ searchTerm + ".org" , dummyTerm , dummyTerm ] , [ dummyTerm + ".com" , searchTerm , dummyTerm ] , [ dummyTerm + ".edu" , searchTerm + dummyTerm , dummyTerm ] , [ dummyTerm + ".net" , dummyTerm , searchTerm ] , [ dummyTerm + ".org" , dummyTerm , searchTerm + dummyTerm ] , [ dummyTerm + ".int" , dummyTerm , dummyTerm ] ] ; const matches = 6 ; var ios = Components . classes [ "@mozilla.org/network/io-service;1" ] . getService ( Components . interfaces . nsIIOService ) ; var cookieSvc = Components . classes [ "@mozilla.org/cookieService;1" ] . getService ( Components . interfaces . nsICookieService ) ; var v ; for ( v in vals ) { let [ host , name , value ] = vals [ v ] ; var cookieUri = ios . newURI ( "http://" + host , null , null ) ; cookieSvc . setCookieString ( cookieUri , null , name + "=" + value + ";" , null ) ; } var cmd = window . openDialog ( "chrome://browser/content/preferences/cookies.xul" , "Browser:Cookies" , "" , { } ) ; cmd . addEventListener ( "load" , function ( ) { executeSoon ( function ( ) { runTest ( cmd , searchTerm , vals . length , matches ) ; } ) ; } , false ) ; }
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
// delete all cookies (might be left over from other tests) // data for cookies // match // match // match // match // match // match // no match // matches must correspond to above data // inject cookies // open cookie manager // when it has loaded, run actual tests