diff --git a/mozilla/calendar/test/unit/head_consts.js b/mozilla/calendar/test/unit/head_consts.js index 79da1cb2921..8013791111e 100644 --- a/mozilla/calendar/test/unit/head_consts.js +++ b/mozilla/calendar/test/unit/head_consts.js @@ -40,30 +40,27 @@ const Cc = Components.classes; const Ci = Components.interfaces; -/// Shortcut to the timezone service -function getTimezoneService() { - if (getTimezoneService.mObject === undefined) { - getTimezoneService.mObject = Cc["@mozilla.org/calendar/timezone-service;1"] - .getService(Ci.calITimezoneService); - } - return getTimezoneService.mObject; +function loadChromeScript(aRelativePath) { + var ioSvc = Cc["@mozilla.org/network/io-service;1"] + .getService(Ci.nsIIOService); + var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Ci.mozIJSSubScriptLoader); + + var dirSvc = Cc["@mozilla.org/file/directory_service;1"] + .getService(Ci.nsIDirectoryServiceProvider); + var dir = dirSvc.getFile("CurWorkD", {}).parent.parent; + dir.append("dist"); + dir.append("bin"); + dir.append("chrome"); + dir.append("calendar.jar"); + + var fileUri = ioSvc.newFileURI(dir); + var jarUri = ioSvc.newURI("jar: " + fileUri.spec + "!/" + aRelativePath, null, null); + + loader.loadSubScript(jarUri.spec, null); } -/// @return the UTC timezone. -function UTC() { - if (UTC.mObject === undefined) { - UTC.mObject = getTimezoneService().UTC; - } - return UTC.mObject; -} - -/// @return the floating timezone. -function floating() { - if (floating.mObject === undefined) { - floating.mObject = getTimezoneService().floating; - } - return floating.mObject; -} +loadChromeScript("content/calendar/calUtils.js"); function createDate(aYear, aMonth, aDay, aHasTime, aHour, aMinute, aSecond, aTimezone) { var cd = Cc["@mozilla.org/calendar/datetime;1"] @@ -209,7 +206,7 @@ function getProps(aItem, aProp) { } } -function compareItems(aLeftItem, aRightItem, aPropArray) { +function compareItemsSpecific(aLeftItem, aRightItem, aPropArray) { if (!aPropArray) { // left out: "id", "calendar", "lastModifiedTime", "generation", // "stampTime" as these are expected to change diff --git a/mozilla/calendar/test/unit/test_providers.js b/mozilla/calendar/test/unit/test_providers.js index ddd71765a71..5aaa9577201 100644 --- a/mozilla/calendar/test/unit/test_providers.js +++ b/mozilla/calendar/test/unit/test_providers.js @@ -19,6 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Philipp Kewisch * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -327,7 +328,7 @@ function run_test() { if (aCount) { count += aCount; for (var i = 0; i < aCount; i++) { - compareItems(aItems[i].parentItem, aItem); + compareItemsSpecific(aItems[i].parentItem, aItem); } } } @@ -360,12 +361,12 @@ function run_test() { aDetail) { do_check_eq(aStatus, 0); if (aOperationType == Ci.calIOperationListener.ADD) { - compareItems(aDetail, aItem); + compareItemsSpecific(aDetail, aItem); // perform getItem() on calendar aCalendar.getItem(aId, listener); } else if (aOperationType == Ci.calIOperationListener.GET) { do_check_eq(count, 1); - compareItems(returnedItem, aItem); + compareItemsSpecific(returnedItem, aItem); } }, onGetResult: function(aCalendar,