function checkAllSearches(aQuery, aExpectedCount)
{
  do_print("Testing all search functions for " + JSON.stringify(aQuery));

  let expectedLogins = buildExpectedLogins(aQuery);
  do_check_eq(expectedLogins.length, aExpectedCount);

  // The findLogins and countLogins functions support wildcard matches by
  // specifying empty strings as parameters, while searchLogins requires
  // omitting the property entirely.
  let hostname = ("hostname" in aQuery) ? aQuery.hostname : "";
  let formSubmitURL = ("formSubmitURL" in aQuery) ? aQuery.formSubmitURL : "";
  let httpRealm = ("httpRealm" in aQuery) ? aQuery.httpRealm : "";

  // Test findLogins.
  let outCount = {};
  let logins = Services.logins.findLogins(outCount, hostname, formSubmitURL,
                                          httpRealm);
  do_check_eq(outCount.value, expectedLogins.length);
  LoginTest.assertLoginListsEqual(logins, expectedLogins);

  // Test countLogins.
  let count = Services.logins.countLogins(hostname, formSubmitURL, httpRealm)
  do_check_eq(count, expectedLogins.length);

  // Test searchLogins.
  checkSearchLogins(aQuery, aExpectedCount);
}
/**
 * Tests findLogins, searchLogins, and countLogins with the same query.
 *
 * @param aQuery
 *        The "hostname", "formSubmitURL", and "httpRealm" properties of this
 *        object are passed as parameters to findLogins and countLogins.  The
 *        same object is then passed to the checkSearchLogins function.
 * @param aExpectedCount
 *        Number of logins from the test data that should be found.  The actual
 *        list of logins is obtained using the buildExpectedLogins helper, and
 *        this value is just used to verify that modifications to the test data
 *        don't make the current test meaningless.
 */
Tests findLogins, searchLogins, and countLogins with the same query.
Tests findLogins searchLogins and countLogins with the same query .
function checkAllSearches(aQuery, aExpectedCount)
{
  do_print("Testing all search functions for " + JSON.stringify(aQuery));
  let expectedLogins = buildExpectedLogins(aQuery);
  do_check_eq(expectedLogins.length, aExpectedCount);
  let hostname = ("hostname" in aQuery) ? aQuery.hostname : "";
  let formSubmitURL = ("formSubmitURL" in aQuery) ? aQuery.formSubmitURL : "";
  let httpRealm = ("httpRealm" in aQuery) ? aQuery.httpRealm : "";
  let outCount = {};
  let logins = Services.logins.findLogins(outCount, hostname, formSubmitURL,
                                          httpRealm);
  do_check_eq(outCount.value, expectedLogins.length);
  LoginTest.assertLoginListsEqual(logins, expectedLogins);
  let count = Services.logins.countLogins(hostname, formSubmitURL, httpRealm)
  do_check_eq(count, expectedLogins.length);
  checkSearchLogins(aQuery, aExpectedCount);
}
function checkAllSearches ( aQuery , aExpectedCount ) { do_print ( "Testing all search functions for " + JSON . stringify ( aQuery ) ) ; let expectedLogins = buildExpectedLogins ( aQuery ) ; do_check_eq ( expectedLogins . length , aExpectedCount ) ; let hostname = ( "hostname" in aQuery ) ? aQuery . hostname : "" ; let formSubmitURL = ( "formSubmitURL" in aQuery ) ? aQuery . formSubmitURL : "" ; let httpRealm = ( "httpRealm" in aQuery ) ? aQuery . httpRealm : "" ; let outCount = { } ; let logins = Services . logins . findLogins ( outCount , hostname , formSubmitURL , httpRealm ) ; do_check_eq ( outCount . value , expectedLogins . length ) ; LoginTest . assertLoginListsEqual ( logins , expectedLogins ) ; let count = Services . logins . countLogins ( hostname , formSubmitURL , httpRealm ) do_check_eq ( count , expectedLogins . length ) ; checkSearchLogins ( aQuery , aExpectedCount ) ; }
Tests findLogins, searchLogins, and countLogins with the same query.
Tests findLogins searchLogins and countLogins with the same query .
// The findLogins and countLogins functions support wildcard matches by // specifying empty strings as parameters, while searchLogins requires // omitting the property entirely. // Test findLogins. // Test countLogins. // Test searchLogins.