32 var
dbe =
Cc[
"@songbirdnest.com/Songbird/DatabaseEngine;1"]
33 .getService(
Ci.sbIDatabaseEngine)
35 var dbq =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
36 .createInstance(
Ci.sbIDatabaseQuery);
38 var
ios =
Cc[
"@mozilla.org/network/io-service;1"]
39 .createInstance(
Ci.nsIIOService);
41 var
dir =
Cc[
"@mozilla.org/file/directory_service;1"]
42 .createInstance(
Ci.nsIProperties);
44 var testdir = dir.get(
"ProfD",
Ci.nsIFile);
46 var actualdir = testdir.clone();
47 actualdir.append(
"db_tests");
49 if(!actualdir.exists())
52 actualdir.create(
Ci.nsIFile.DIRECTORY_TYPE, 0700);
59 var
uri = ios.newFileURI(actualdir);
60 dbq.databaseLocation =
uri;
64 dbq.setDatabaseGUID(
"test_closedatabase");
66 dbq.addQuery(
"drop table test");
67 dbq.addQuery(
"create table test (key text, value text)");
68 dbq.addQuery(
"insert into test values ('mykey', 'myvalue')");
71 dbq.waitForCompletion();
74 dbe.closeDatabase(
"test_closedatabase");
76 var dbfile = actualdir.clone();
77 dbfile.append(
"test_closedatabase.db")
86 return Components.results.NS_OK;
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function assertFalse(aTest, aMessage)
function runTest()
Test file.