|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 const Ci = Components.interfaces; |
|
5 const Cc = Components.classes; |
|
6 const Cr = Components.results; |
|
7 const Cu = Components.utils; |
|
8 |
|
9 Cu.import("resource://gre/modules/Services.jsm"); |
|
10 |
|
11 // Import common head. |
|
12 let (commonFile = do_get_file("../head_common.js", false)) { |
|
13 let uri = Services.io.newFileURI(commonFile); |
|
14 Services.scriptloader.loadSubScript(uri.spec, this); |
|
15 } |
|
16 |
|
17 // Put any other stuff relative to this test folder below. |
|
18 |
|
19 const kDBName = "places.sqlite"; |
|
20 |
|
21 /** |
|
22 * Sets the database to use for the given test. This should be the very first |
|
23 * thing we do otherwise, this database will not be used! |
|
24 * |
|
25 * @param aFileName |
|
26 * The filename of the database to use. This database must exist in |
|
27 * toolkit/components/places/tests/migration! |
|
28 */ |
|
29 function setPlacesDatabase(aFileName) |
|
30 { |
|
31 let file = do_get_file(aFileName); |
|
32 |
|
33 // Ensure that our database doesn't already exist. |
|
34 let (dbFile = gProfD.clone()) { |
|
35 dbFile.append(kDBName); |
|
36 do_check_false(dbFile.exists()); |
|
37 } |
|
38 |
|
39 file.copyToFollowingLinks(gProfD, kDBName); |
|
40 } |