1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/migration/head_migration.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,40 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +const Ci = Components.interfaces; 1.8 +const Cc = Components.classes; 1.9 +const Cr = Components.results; 1.10 +const Cu = Components.utils; 1.11 + 1.12 +Cu.import("resource://gre/modules/Services.jsm"); 1.13 + 1.14 +// Import common head. 1.15 +let (commonFile = do_get_file("../head_common.js", false)) { 1.16 + let uri = Services.io.newFileURI(commonFile); 1.17 + Services.scriptloader.loadSubScript(uri.spec, this); 1.18 +} 1.19 + 1.20 +// Put any other stuff relative to this test folder below. 1.21 + 1.22 +const kDBName = "places.sqlite"; 1.23 + 1.24 +/** 1.25 + * Sets the database to use for the given test. This should be the very first 1.26 + * thing we do otherwise, this database will not be used! 1.27 + * 1.28 + * @param aFileName 1.29 + * The filename of the database to use. This database must exist in 1.30 + * toolkit/components/places/tests/migration! 1.31 + */ 1.32 +function setPlacesDatabase(aFileName) 1.33 +{ 1.34 + let file = do_get_file(aFileName); 1.35 + 1.36 + // Ensure that our database doesn't already exist. 1.37 + let (dbFile = gProfD.clone()) { 1.38 + dbFile.append(kDBName); 1.39 + do_check_false(dbFile.exists()); 1.40 + } 1.41 + 1.42 + file.copyToFollowingLinks(gProfD, kDBName); 1.43 +}