1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/places/tests/unit/head_bookmarks.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +const Ci = Components.interfaces; 1.10 +const Cc = Components.classes; 1.11 +const Cr = Components.results; 1.12 +const Cu = Components.utils; 1.13 + 1.14 +Cu.import("resource://gre/modules/Services.jsm"); 1.15 +Cu.import("resource://gre/modules/LoadContextInfo.jsm"); 1.16 + 1.17 +// Import common head. 1.18 +let (commonFile = do_get_file("../../../../../toolkit/components/places/tests/head_common.js", false)) { 1.19 + let uri = Services.io.newFileURI(commonFile); 1.20 + Services.scriptloader.loadSubScript(uri.spec, this); 1.21 +} 1.22 + 1.23 +// Put any other stuff relative to this test folder below. 1.24 + 1.25 + 1.26 +XPCOMUtils.defineLazyGetter(this, "PlacesUIUtils", function() { 1.27 + Cu.import("resource:///modules/PlacesUIUtils.jsm"); 1.28 + return PlacesUIUtils; 1.29 +}); 1.30 + 1.31 + 1.32 +const ORGANIZER_FOLDER_ANNO = "PlacesOrganizer/OrganizerFolder"; 1.33 +const ORGANIZER_QUERY_ANNO = "PlacesOrganizer/OrganizerQuery"; 1.34 + 1.35 + 1.36 +// Needed by some test that relies on having an app registered. 1.37 +let (XULAppInfo = { 1.38 + vendor: "Mozilla", 1.39 + name: "PlacesTest", 1.40 + ID: "{230de50e-4cd1-11dc-8314-0800200c9a66}", 1.41 + version: "1", 1.42 + appBuildID: "2007010101", 1.43 + platformVersion: "", 1.44 + platformBuildID: "2007010101", 1.45 + inSafeMode: false, 1.46 + logConsoleErrors: true, 1.47 + OS: "XPCShell", 1.48 + XPCOMABI: "noarch-spidermonkey", 1.49 + 1.50 + QueryInterface: XPCOMUtils.generateQI([ 1.51 + Ci.nsIXULAppInfo, 1.52 + Ci.nsIXULRuntime, 1.53 + ]) 1.54 +}) { 1.55 + let XULAppInfoFactory = { 1.56 + createInstance: function (outer, iid) { 1.57 + if (outer != null) 1.58 + throw Cr.NS_ERROR_NO_AGGREGATION; 1.59 + return XULAppInfo.QueryInterface(iid); 1.60 + } 1.61 + }; 1.62 + let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); 1.63 + registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"), 1.64 + "XULAppInfo", "@mozilla.org/xre/app-info;1", 1.65 + XULAppInfoFactory); 1.66 +} 1.67 + 1.68 +// Smart bookmarks constants. 1.69 +const SMART_BOOKMARKS_VERSION = 7; 1.70 +const SMART_BOOKMARKS_ON_TOOLBAR = 1; 1.71 +const SMART_BOOKMARKS_ON_MENU = 3; // Takes into account the additional separator. 1.72 + 1.73 +// Default bookmarks constants. 1.74 +const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1; 1.75 +const DEFAULT_BOOKMARKS_ON_MENU = 1;