B2G/gecko/toolkit/components/url-classifier/tests/unit/test_addsub.js
// match (tests that existing sub entries are properly updated)
match (tests that existing sub entries are properly updated)
match ( tests that existing sub entries are properly updated )
function testSubsDifferentChunks() {
  var subUrls1 = [ "3:foo.com/a" ];
  var subUrls2 = [ "3:foo.com/b" ];
  var addUrls = [ "foo.com/a", "foo.com/b", "foo.com/c" ];
  var subUpdate1 = buildPhishingUpdate(
    [{ "chunkNum" : 1,
       "chunkType" : "s",
       "urls": subUrls1 }]);
  var subUpdate2 = buildPhishingUpdate(
    [{ "chunkNum" : 2,
       "chunkType" : "s",
       "urls" : subUrls2 }]);
  var addUpdate = buildPhishingUpdate(
    [{ "chunkNum" : 3,
       "urls" : addUrls }]);
  var assertions = {
    "tableData" : "test-phish-simple;a:3:s:1-2",
    "urlsExist" : [ "foo.com/c" ],
    "urlsDontExist" : [ "foo.com/a", "foo.com/b" ],
    "subsDontExist" : [ "foo.com/a", "foo.com/b" ]
  };
  doTest([subUpdate1, subUpdate2, addUpdate], assertions);
}
function testSubsDifferentChunks ( ) { var subUrls1 = [ "3:foo.com/a" ] ; var subUrls2 = [ "3:foo.com/b" ] ; var addUrls = [ "foo.com/a" , "foo.com/b" , "foo.com/c" ] ; var subUpdate1 = buildPhishingUpdate ( [ { "chunkNum" : 1 , "chunkType" : "s" , "urls" : subUrls1 } ] ) ; var subUpdate2 = buildPhishingUpdate ( [ { "chunkNum" : 2 , "chunkType" : "s" , "urls" : subUrls2 } ] ) ; var addUpdate = buildPhishingUpdate ( [ { "chunkNum" : 3 , "urls" : addUrls } ] ) ; var assertions = { "tableData" : "test-phish-simple;a:3:s:1-2" , "urlsExist" : [ "foo.com/c" ] , "urlsDontExist" : [ "foo.com/a" , "foo.com/b" ] , "subsDontExist" : [ "foo.com/a" , "foo.com/b" ] } ; doTest ( [ subUpdate1 , subUpdate2 , addUpdate ] , assertions ) ; }
match (tests that existing sub entries are properly updated)
match ( tests that existing sub entries are properly updated )