michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const Ci = Components.interfaces; michael@0: const Cc = Components.classes; michael@0: const Cr = Components.results; michael@0: const Cu = Components.utils; michael@0: michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: // Import common head. michael@0: let (commonFile = do_get_file("../head_common.js", false)) { michael@0: let uri = Services.io.newFileURI(commonFile); michael@0: Services.scriptloader.loadSubScript(uri.spec, this); michael@0: } michael@0: michael@0: // Put any other stuff relative to this test folder below. michael@0: michael@0: const kDBName = "places.sqlite"; michael@0: michael@0: /** michael@0: * Sets the database to use for the given test. This should be the very first michael@0: * thing we do otherwise, this database will not be used! michael@0: * michael@0: * @param aFileName michael@0: * The filename of the database to use. This database must exist in michael@0: * toolkit/components/places/tests/migration! michael@0: */ michael@0: function setPlacesDatabase(aFileName) michael@0: { michael@0: let file = do_get_file(aFileName); michael@0: michael@0: // Ensure that our database doesn't already exist. michael@0: let (dbFile = gProfD.clone()) { michael@0: dbFile.append(kDBName); michael@0: do_check_false(dbFile.exists()); michael@0: } michael@0: michael@0: file.copyToFollowingLinks(gProfD, kDBName); michael@0: }