B2G/gecko/toolkit/components/url-classifier/tests/unit/test_addsub.js
// Test that a sub will remove an existing add
Test that a sub will remove an existing add
Test that a sub will remove an existing add
function testSimpleSub()
{
  var addUrls = ["foo.com/a", "bar.com/b"];
  var subUrls = ["1:foo.com/a"];
  var addUpdate = buildPhishingUpdate(
    [{ "chunkNum" : 1, 
       "urls": addUrls }]);
  var subUpdate = buildPhishingUpdate(
    [{ "chunkNum" : 50,
       "chunkType" : "s",
       "urls": subUrls }]);
  var assertions = {
    "tableData" : "test-phish-simple;a:1:s:50",
    "urlsExist" : [ "bar.com/b" ],
    "urlsDontExist": ["foo.com/a" ],
    "subsDontExist" : [ "foo.com/a" ]
  }
  doTest([addUpdate, subUpdate], assertions);
}
function testSimpleSub ( ) { var addUrls = [ "foo.com/a" , "bar.com/b" ] ; var subUrls = [ "1:foo.com/a" ] ; var addUpdate = buildPhishingUpdate ( [ { "chunkNum" : 1 , "urls" : addUrls } ] ) ; var subUpdate = buildPhishingUpdate ( [ { "chunkNum" : 50 , "chunkType" : "s" , "urls" : subUrls } ] ) ; var assertions = { "tableData" : "test-phish-simple;a:1:s:50" , "urlsExist" : [ "bar.com/b" ] , "urlsDontExist" : [ "foo.com/a" ] , "subsDontExist" : [ "foo.com/a" ] } doTest ( [ addUpdate , subUpdate ] , assertions ) ; }
Test that a sub will remove an existing add
Test that a sub will remove an existing add
// adds and subtracts don't share a chunk numbering space