Fix bug 432794 - Allow loading chrome scripts in test cases. r=dbo
git-svn-id: svn://10.0.0.236/trunk@251396 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
8c50ee66bb
commit
e348333306
@ -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
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Philipp Kewisch <mozilla@kewis.ch>
|
||||
*
|
||||
* 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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user