Bug 1498710: Properly wait for profile set up to complete before proceeding with the test. r=janerik
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 23 Oct 2018 08:57:28 +0000
changeset 490936 75b79428f0fa2670c6b1865b38f09ab2589cb232
parent 490935 fbbe71ee84680831bc452626545c58b57763886a
child 490937 51b0078af6385a478f640ca30c87c74586e70d32
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjanerik
bugs1498710
milestone65.0a1
Bug 1498710: Properly wait for profile set up to complete before proceeding with the test. r=janerik Differential Revision: https://phabricator.services.mozilla.com/D9441
toolkit/modules/tests/xpcshell/test_ProfileAge.js
--- a/toolkit/modules/tests/xpcshell/test_ProfileAge.js
+++ b/toolkit/modules/tests/xpcshell/test_ProfileAge.js
@@ -21,17 +21,17 @@ add_task(withDummyProfile(async (profile
   Assert.equal(await times.reset, undefined, "Reset time is undefined in a new profile");
   Assert.ok((await times.firstUse) <= Date.now(), "Should have initialised a first use time.");
 }));
 
 add_task(withDummyProfile(async (profile) => {
   const CREATED_TIME = Date.now() - 2000;
   const RESET_TIME = Date.now() - 1000;
 
-  CommonUtils.writeJSON({
+  await CommonUtils.writeJSON({
     created: CREATED_TIME,
   }, OS.Path.join(profile, "times.json"));
 
   let times = await ProfileAge(profile);
   Assert.equal((await times.created), CREATED_TIME, "Should have seen the right profile time.");
   Assert.equal((await times.firstUse), undefined, "Should be no first use time.");
 
   let times2 = await ProfileAge(profile);
@@ -64,16 +64,16 @@ add_task(withDummyProfile(async (profile
   Assert.deepEqual(results, {
     reset: RESET_TIME2,
   }, "Should have seen the right results.");
 }));
 
 add_task(withDummyProfile(async (profile) => {
   const CREATED_TIME = Date.now() - 1000;
 
-  CommonUtils.writeJSON({
+  await CommonUtils.writeJSON({
     created: CREATED_TIME,
     firstUse: null,
   }, OS.Path.join(profile, "times.json"));
 
   let times = await ProfileAge(profile);
   Assert.ok((await times.firstUse) <= Date.now(), "Should have initialised a first use time.");
 }));