B2G/gecko/toolkit/components/url-classifier/tests/unit/test_streamupdater.js
// invalid MACs on the forwards.
invalid MACs on the forwards.
invalid MACs on the forwards .
function testInvalidForwardMAC() {
  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) +
    ",BADMAC\n";
  var update2 = buildBareUpdate(
    [{ "chunkNum" : 2,
       "urls" : add2Urls }]);
  update += "u:data:," + encodeURIComponent(update2) +
    ",BADMAC\n";
  var update3 = buildBareUpdate(
    [{ "chunkNum" : 3,
       "urls" : add3Urls }]);
  update += "u:data:," + encodeURIComponent(update3) +
    ",BADMAC\n";
  var assertions = {
    "tableData" : "",
    "urlsDontExist" : add1Urls.concat(add2Urls).concat(add3Urls)
  };
  update = "m:" + MAC(update, gClientKeyRaw) + "\n" + update;
  doTest([update], assertions, true, gClientKey);
}
function testInvalidForwardMAC ( ) { 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 ) + ",BADMAC\n" ; var update2 = buildBareUpdate ( [ { "chunkNum" : 2 , "urls" : add2Urls } ] ) ; update += "u:data:," + encodeURIComponent ( update2 ) + ",BADMAC\n" ; var update3 = buildBareUpdate ( [ { "chunkNum" : 3 , "urls" : add3Urls } ] ) ; update += "u:data:," + encodeURIComponent ( update3 ) + ",BADMAC\n" ; var assertions = { "tableData" : "" , "urlsDontExist" : add1Urls . concat ( add2Urls ) . concat ( add3Urls ) } ; update = "m:" + MAC ( update , gClientKeyRaw ) + "\n" + update ; doTest ( [ update ] , assertions , true , gClientKey ) ; }
invalid MACs on the forwards.
invalid MACs on the forwards .