Bug 855556 - Test the cached branch of getAll more extensively. r=gwagner

This commit is contained in:
Reuben Morais 2013-04-26 15:05:06 -07:00
parent 7124b8a0a0
commit 82cfae8d50
2 changed files with 33 additions and 21 deletions

View File

@ -72,7 +72,7 @@ function ContactDispatcher(aContacts, aFullContacts, aCallback, aNewTxn, aClearD
aCallback(chunk);
chunk.length = 0;
nextIndex += CHUNK_SIZE;
interval = setTimeout(this.sendChunk, CHUNK_INTERVAL);
interval = setTimeout(sendChunk, CHUNK_INTERVAL);
}
}
}

View File

@ -195,20 +195,9 @@ let index = 0;
let req;
let mozContacts = window.navigator.mozContacts;
let steps = [
clearDatabase,
function() {
// add a contact
createResult1 = new mozContact();
createResult1.init({});
req = navigator.mozContacts.save(createResult1);
req.onsuccess = function() {
next();
};
req.onerror = onFailure;
},
function() {
ok(true, "Retrieving one contact with getAll");
function getOne(msg) {
return function() {
ok(true, msg || "Retrieving one contact with getAll");
req = mozContacts.getAll({});
let count = 0;
req.onsuccess = function(event) {
@ -223,13 +212,12 @@ let steps = [
}
};
req.onerror = onFailure;
},
};
}
clearDatabase,
addContacts,
function() {
ok(true, "Retrieving 40 contacts with getAll");
function getAll(msg) {
return function() {
ok(true, msg || "Retrieving 40 contacts with getAll");
req = mozContacts.getAll({
sortBy: "familyName",
sortOrder: "ascending"
@ -251,7 +239,31 @@ let steps = [
}
};
req.onerror = onFailure;
}
}
let steps = [
clearDatabase,
function() {
// add a contact
createResult1 = new mozContact();
createResult1.init({});
req = navigator.mozContacts.save(createResult1);
req.onsuccess = function() {
next();
};
req.onerror = onFailure;
},
getOne(),
getOne("Retrieving one contact with getAll - cached"),
clearDatabase,
addContacts,
getAll(),
getAll("Retrieving 40 contacts with getAll - cached"),
function() {
ok(true, "Deleting one contact");
req = mozContacts.remove(createResult1);