gecko-dev/dom/mobilemessage/tests/marionette/test_mmdb_new.js

37 lines
963 B
JavaScript
Raw Normal View History

2013-12-12 03:45:35 +00:00
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 60000;
MARIONETTE_HEAD_JS = 'mmdb_head.js';
const DBNAME = "test_mmdb_new:" + newUUID();
var dbVersion = 0;
function check(aMmdb) {
is(aMmdb.dbName, DBNAME, "dbName");
if (!dbVersion) {
ok(aMmdb.dbVersion, "dbVersion");
dbVersion = aMmdb.dbVersion;
} else {
is(aMmdb.dbVersion, dbVersion, "dbVersion");
}
}
2013-12-12 03:45:35 +00:00
startTestBase(function testCaseMain() {
log("Test init MobileMessageDB");
let mmdb = newMobileMessageDB();
return initMobileMessageDB(mmdb, DBNAME, dbVersion)
.then(() => check(mmdb))
.then(() => closeMobileMessageDB(mmdb))
.then(() => check(mmdb))
.then(function() {
2013-12-12 03:45:35 +00:00
log("Test re-init and close.");
return initMobileMessageDB(mmdb, DBNAME, dbVersion);
2013-12-12 03:45:35 +00:00
})
.then(() => check(mmdb))
.then(() => closeMobileMessageDB(mmdb))
.then(() => check(mmdb));
2013-12-12 03:45:35 +00:00
});