B2G/gecko/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
// Test that actual results and expected results are equal
Test that actual results and expected results are equal
Test that actual results and expected results are equal
function check_results(aActualAddons, aExpectedAddons, aAddonCount, aInstallNull) {
  do_check_false(AddonRepository.isSearching);
  do_check_eq(aActualAddons.length, aAddonCount);
  do_check_addons(aActualAddons, aExpectedAddons, ADDON_PROPERTIES);
  aActualAddons.forEach(function(aActualAddon) {
    if (aActualAddon.name == "FAIL")
      do_throw(aActualAddon.id + " - " + aActualAddon.description);
    if (aActualAddon.name != "PASS")
      do_throw(aActualAddon.id + " - " + "invalid add-on name " + aActualAddon.name);
    do_check_eq(aActualAddon.install == null, !!aInstallNull || !aActualAddon.sourceURI);
    if (aActualAddon.install)
      do_check_eq(aActualAddon.install.sourceURI.spec, aActualAddon.sourceURI.spec);
  });
}
function check_results ( aActualAddons , aExpectedAddons , aAddonCount , aInstallNull ) { do_check_false ( AddonRepository . isSearching ) ; do_check_eq ( aActualAddons . length , aAddonCount ) ; do_check_addons ( aActualAddons , aExpectedAddons , ADDON_PROPERTIES ) ; aActualAddons . forEach ( function ( aActualAddon ) { if ( aActualAddon . name == "FAIL" ) do_throw ( aActualAddon . id + " - " + aActualAddon . description ) ; if ( aActualAddon . name != "PASS" ) do_throw ( aActualAddon . id + " - " + "invalid add-on name " + aActualAddon . name ) ; do_check_eq ( aActualAddon . install == null , ! ! aInstallNull || ! aActualAddon . sourceURI ) ; if ( aActualAddon . install ) do_check_eq ( aActualAddon . install . sourceURI . spec , aActualAddon . sourceURI . spec ) ; } ) ; }
Test that actual results and expected results are equal
Test that actual results and expected results are equal
// Additional tests // Separately check name so better messages are outputted when failure // Check that sourceURI property consistent within actual addon