gecko-dev/toolkit/components/osfile/tests/xpcshell/test_creationDate.js
Victor Porof 4a06c925ac Bug 1561435 - Format toolkit/components/, a=automatic-formatting
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D36052

--HG--
extra : source : b5be5b4f4b47c256e28a29f665dc754f6407ee7f
2019-07-05 11:14:05 +02:00

36 lines
912 B
JavaScript

"use strict";
function run_test() {
do_test_pending();
run_next_test();
}
/**
* Test to ensure that deprecation warning is issued on use
* of creationDate.
*/
add_task(async function test_deprecatedCreationDate() {
let currentDir = await OS.File.getCurrentDirectory();
let path = OS.Path.join(currentDir, "test_creationDate.js");
let consoleMessagePromise = new Promise(resolve => {
let consoleListener = {
observe(aMessage) {
if (
aMessage.message.indexOf("Field 'creationDate' is deprecated.") > -1
) {
info("Deprecation message printed");
Assert.ok(true);
Services.console.unregisterListener(consoleListener);
resolve();
}
},
};
Services.console.registerListener(consoleListener);
});
(await OS.File.stat(path)).creationDate;
await consoleMessagePromise;
});
add_task(do_test_finished);