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;
|
2014-03-13 04:44:49 +00:00
|
|
|
MARIONETTE_HEAD_JS = 'mmdb_head.js';
|
|
|
|
|
|
|
|
const DBNAME = "test_mmdb_new:" + newUUID();
|
2015-09-15 18:19:45 +00:00
|
|
|
var dbVersion = 0;
|
2014-03-13 04:44:49 +00:00
|
|
|
|
|
|
|
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();
|
2014-03-13 04:44:49 +00:00
|
|
|
return initMobileMessageDB(mmdb, DBNAME, dbVersion)
|
2014-03-13 04:44:53 +00:00
|
|
|
.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.");
|
2014-03-13 04:44:53 +00:00
|
|
|
return initMobileMessageDB(mmdb, DBNAME, dbVersion);
|
2013-12-12 03:45:35 +00:00
|
|
|
})
|
2014-03-13 04:44:53 +00:00
|
|
|
.then(() => check(mmdb))
|
|
|
|
.then(() => closeMobileMessageDB(mmdb))
|
|
|
|
.then(() => check(mmdb));
|
2013-12-12 03:45:35 +00:00
|
|
|
});
|