Bug 1387303 - fix test_places_guid_downgrade.js to work correctly in the new async-sync world. r=eoger

MozReview-Commit-ID: 4bmu45qUmFA
This commit is contained in:
Mark Hammond 2017-08-04 11:49:15 +10:00
parent b56bbf2305
commit 4f08809c1f

View File

@ -109,17 +109,10 @@ add_task(async function test_history_guids() {
}]
}
];
PlacesUtils.asyncHistory.updatePlaces(places, {
handleError: function handleError() {
do_throw("Unexpected error in adding visit.");
},
handleResult: function handleResult() {},
handleCompletion: onVisitAdded
});
function onVisitAdded() {
let fxguid = store.GUIDForUri(fxuri, true);
let tbguid = store.GUIDForUri(tburi, true);
async function onVisitAdded() {
let fxguid = await store.GUIDForUri(fxuri, true);
let tbguid = await store.GUIDForUri(tburi, true);
dump("fxguid: " + fxguid + "\n");
dump("tbguid: " + tbguid + "\n");
@ -151,9 +144,17 @@ add_task(async function test_history_guids() {
result = Async.querySpinningly(stmt, ["guid"]);
do_check_eq(result.length, 0);
stmt.finalize();
run_next_test();
}
await new Promise((resolve, reject) => {
PlacesUtils.asyncHistory.updatePlaces(places, {
handleError: function handleError() {
do_throw("Unexpected error in adding visit.");
},
handleResult: function handleResult() {},
handleCompletion: () => { onVisitAdded().then(resolve, reject) },
});
});
});
add_task(async function test_bookmark_guids() {