B2G/gecko/toolkit/components/url-classifier/tests/unit/test_streamupdater.js
// specified for sub-urls.
specified for sub-urls.
specified for sub - urls .
function testNoForwardMAC() {
  var add1Urls = [ "foo.com/a", "bar.com/c" ];
  var add2Urls = [ "foo.com/b" ];
  var add3Urls = [ "bar.com/d" ];
  var update = "n:1000\n";
  update += "i:test-phish-simple\n";
  var update1 = buildBareUpdate(
    [{ "chunkNum" : 1,
       "urls" : add1Urls }]);
  update += "u:data:" + encodeURIComponent(update1) + "\n";
  var update2 = buildBareUpdate(
    [{ "chunkNum" : 2,
       "urls" : add2Urls }]);
  update += "u:data:" + encodeURIComponent(update2) + "\n";
  var update3 = buildBareUpdate(
    [{ "chunkNum" : 3,
       "urls" : add3Urls }]);
  update += "u:data:" + encodeURIComponent(update3) + "\n";
  var assertions = {
    "tableData" : "",
    "urlsDontExist" : add1Urls.concat(add2Urls).concat(add3Urls)
  };
  update = "m:" + MAC(update, gClientKeyRaw) + "\n" + update;
  doTest([update], assertions, true, gClientKey);
}
function testNoForwardMAC ( ) { var add1Urls = [ "foo.com/a" , "bar.com/c" ] ; var add2Urls = [ "foo.com/b" ] ; var add3Urls = [ "bar.com/d" ] ; var update = "n:1000\n" ; update += "i:test-phish-simple\n" ; var update1 = buildBareUpdate ( [ { "chunkNum" : 1 , "urls" : add1Urls } ] ) ; update += "u:data:" + encodeURIComponent ( update1 ) + "\n" ; var update2 = buildBareUpdate ( [ { "chunkNum" : 2 , "urls" : add2Urls } ] ) ; update += "u:data:" + encodeURIComponent ( update2 ) + "\n" ; var update3 = buildBareUpdate ( [ { "chunkNum" : 3 , "urls" : add3Urls } ] ) ; update += "u:data:" + encodeURIComponent ( update3 ) + "\n" ; var assertions = { "tableData" : "" , "urlsDontExist" : add1Urls . concat ( add2Urls ) . concat ( add3Urls ) } ; update = "m:" + MAC ( update , gClientKeyRaw ) + "\n" + update ; doTest ( [ update ] , assertions , true , gClientKey ) ; }
specified for sub-urls.
specified for sub - urls .
// XXX : This test presents invalid data: urls as forwards.  A valid // data url requires a comma, which the code will interpret as the // separator for a MAC. // Unfortunately this means that the update will fail even if the code // isn't properly detecting a missing MAC update.  I'm not sure how to // test that :/