Bug 1471326 - Build GData Provider with Thunderbird and re-enable its test test_gdata_provider.js. r=philipp

--HG--
rename : calendar/providers/gdata/install.rdf => calendar/providers/gdata/manifest.json
extra : rebase_source : df6287d07edb7fa8923dcbc3d5e18e2dd6bac091
This commit is contained in:
Geoff Lankow 2018-08-02 11:28:58 +12:00
Родитель 6520e0768c
Коммит 99b095584a
10 изменённых файлов: 187 добавлений и 195 удалений

Просмотреть файл

@ -12,8 +12,6 @@ else
LIGHTNING_VERSION := $(shell $(PYTHON) $(commtopsrcdir)/calendar/lightning/build/makeversion.py $(word 1,$(MOZ_PKG_VERSION) $(THUNDERBIRD_VERSION)))
endif
#GDATA_VERSION := $(shell $(PYTHON) $(commtopsrcdir)/calendar/providers/gdata/makeversion.py $(LIGHTNING_VERSION))
# For extensions we require a max version that is compatible across security releases.
# THUNDERBIRD_MAXVERSION and SEAMONKEY_MAXVERSION is our method for doing that.
# Alpha versions 10.0a1 and 10.0a2 aren't affected

Просмотреть файл

@ -2,32 +2,27 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPI_PKGNAME = gdata-provider-$(GDATA_VERSION).$(AB_CD).$(MOZ_PKG_PLATFORM)
XPI_VERSION = $(GDATA_VERSION)
XPI_NAME = gdata-provider
XPI_PKGNAME = gdata-provider.$(AB_CD)
XPI_EM_ID = {a62ef8ec-5fdc-40c2-873c-223b8a6925cc}
XPI_INSTALL_EXTENSION = $(XPI_EM_ID)
DEFINES += -DLIGHTNING_VERSION=$(LIGHTNING_VERSION) \
-DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
ifdef MOZ_SUITE
LIGHTNING_VERSION := $(shell $(PYTHON) $(commtopsrcdir)/calendar/lightning/build/makeversion.py $(THUNDERBIRD_VERSION))
else
LIGHTNING_VERSION := $(shell $(PYTHON) $(commtopsrcdir)/calendar/lightning/build/makeversion.py $(word 1,$(MOZ_PKG_VERSION) $(THUNDERBIRD_VERSION)))
endif
GDATA_VERSION := $(shell $(PYTHON) $(commtopsrcdir)/calendar/providers/gdata/makeversion.py $(LIGHTNING_VERSION))
THUNDERBIRD_VERSION := $(shell cat $(commtopsrcdir)/mail/config/version.txt)
SEAMONKEY_VERSION := $(shell cat $(commtopsrcdir)/suite/config/version.txt)
DEFINES += -DSEAMONKEY_VERSION=$(SEAMONKEY_VERSION) \
-DTHUNDERBIRD_VERSION=$(THUNDERBIRD_VERSION) \
-DCOMM_BUILD=$(COMM_BUILD) \
-DGDATA_VERSION=$(GDATA_VERSION) \
$(NULL)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
# If the macbundle dist dir was already created, sync the gdata provider here to avoid
# the need to make -C objdir/mail/app each time
tools repackage::
[ -d $(DIST)/$(MOZ_MACBUNDLE_NAME) ] && rsync -a $(FINAL_TARGET)/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/extensions/$(XPI_EM_ID) || true
endif
# stage the extension for use in packaged tests
PKG_STAGE = $(DIST)/test-stage
include $(commtopsrcdir)/calendar/lightning/lightning-packager.mk
stage-package:
$(NSINSTALL) -D $(PKG_STAGE)/extensions/$(XPI_EM_ID)
(cd $(FINAL_TARGET) && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/extensions/$(XPI_EM_ID) && tar -xf -)
include $(moztopsrcdir)/config/rules.mk
include $(commtopsrcdir)/calendar/lightning/versions.mk
include $(commtopsrcdir)/calendar/lightning/lightning-packager.mk
$(PYTHON) -u $(MOZILLA_DIR)/build/upload.py $(DIST)/xpi-stage/$(XPI_PKGNAME).xpi

Просмотреть файл

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
#filter substitution
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}</em:id>
<em:version>@GDATA_VERSION@</em:version>
<em:type>2</em:type>
<!-- Target Application this extension can install into,
with minimum and maximum supported versions. -->
<em:targetApplication>
<Description>
<!-- Thunderbird -->
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>52.0</em:minVersion>
<em:maxVersion>@THUNDERBIRD_VERSION@</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication>
<Description>
<!-- SeaMonkey -->
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
<em:minVersion>2.49</em:minVersion>
<em:maxVersion>@SEAMONKEY_VERSION@</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Provider for Google Calendar</em:name>
<em:description>Allows bidirectional access to Google Calendar</em:description>
<em:creator>Philipp Kewisch</em:creator>
<em:contributor>Mark James (http://www.famfamfam.com/lab/icons/silk/)</em:contributor>
<em:homepageURL>https://addons.mozilla.org/thunderbird/addon/4631</em:homepageURL>
<em:iconURL>chrome://gdata-provider/content/gcal.png</em:iconURL>
</Description>
</RDF>

Просмотреть файл

@ -0,0 +1,23 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#filter substitution
{
"manifest_version": 2,
"name": "Provider for Google Calendar",
"description": "Allows bidirectional access to Google Calendar",
"version": "@GDATA_VERSION@",
"author": "Philipp Kewisch",
"homepage_url": "https://addons.mozilla.org/thunderbird/addon/4631",
"legacy": true,
"applications": {
"gecko": {
"id": "{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}",
"strict_min_version": "@THUNDERBIRD_VERSION@"
}
},
"icons": {
"32": "chrome://gdata-provider/content/gcal.png"
}
}

Просмотреть файл

@ -4,8 +4,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPI_NAME = 'gdata-provider'
export('XPI_NAME')
FINAL_TARGET_PP_FILES += ['install.rdf']
FINAL_TARGET_PP_FILES += ['manifest.json']
DIRS += [
'locales',
@ -28,6 +29,9 @@ EXTRA_COMPONENTS += [
JAR_MANIFESTS += ['jar.mn']
USE_EXTENSION_MANIFEST = True
export('USE_EXTENSION_MANIFEST')
JS_PREFERENCE_FILES += [
'defaults/preferences.js',
]

Просмотреть файл

@ -9,12 +9,20 @@
Services.prefs.setBoolPref("calendar.debug.log", true);
Services.prefs.setBoolPref("calendar.debug.log.verbose", true);
let bindir = Services.dirsvc.get("CurProcD", Components.interfaces.nsIFile);
bindir.append("extensions");
bindir.append("{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}");
bindir.append("chrome.manifest");
dump("Loading" + bindir.path + "\n");
Components.manager.autoRegister(bindir);
let xpiFile;
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
if (env.exists("MOZ_FETCHES_DIR")) {
xpiFile = new FileUtils.File(env.get("MOZ_FETCHES_DIR"));
xpiFile.append("gdata-provider.en-US.xpi");
} else {
xpiFile = Services.dirsvc.get("CurProcD", Components.interfaces.nsIFile);
xpiFile.append("extensions");
xpiFile.append("{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}");
}
dump("Loading " + xpiFile.path + "\n");
let manager = Cc["@mozilla.org/component-manager-extra;1"].getService(Ci.nsIComponentManagerExtra);
manager.addLegacyExtensionManifestLocation(xpiFile);
})();
ChromeUtils.import("resource://testing-common/httpd.js");
@ -507,7 +515,7 @@ function run_test() {
});
}
add_task(function* test_migrate_cache() {
add_task(async function test_migrate_cache() {
let uriString = "googleapi://xpcshell/?calendar=xpcshell%40example.com";
let uri = Services.io.newURI(uriString);
let client = cal.getCalendarManager().createCalendar("gdata", uri);
@ -519,26 +527,26 @@ add_task(function* test_migrate_cache() {
});
// No version, should not reset
equal(yield migrateStorageCache(), false);
equal(await migrateStorageCache(), false);
equal(client.getProperty("cache.version"), 3);
// Check migrate 1 -> 2
unwrapped.CACHE_DB_VERSION = 2;
client.setProperty("cache.version", 1);
equal(yield migrateStorageCache(), true);
equal(await migrateStorageCache(), true);
equal(client.getProperty("cache.version"), 2);
// Check migrate 2 -> 3 normal calendar
unwrapped.CACHE_DB_VERSION = 3;
client.setProperty("cache.version", 2);
equal(yield migrateStorageCache(), false);
equal(await migrateStorageCache(), false);
// Check migrate 2 -> 3 birthday calendar
unwrapped.CACHE_DB_VERSION = 3;
uri = "googleapi://xpcshell/?calendar=%23contacts%40group.v.calendar.google.com";
unwrapped.uri = Services.io.newURI(uri);
client.setProperty("cache.version", 2);
equal(yield migrateStorageCache(), true);
equal(await migrateStorageCache(), true);
});
add_test(function test_migrate_uri() {
@ -572,7 +580,7 @@ add_test(function test_migrate_uri() {
run_next_test();
});
add_task(function* test_dateToJSON() {
add_task(async function test_dateToJSON() {
function _createDateTime(tzid, offset=0) {
let offsetFrom = offset <= 0 ? "-0" + (offset - 1) : "+0" + (offset - 1) + "00";
let offsetTo = "+0" + offset + "00";
@ -671,7 +679,7 @@ add_task(function* test_dateToJSON() {
deepEqual(dateToJSON(date), { date: "2015-01-30" });
});
add_task(function* test_JSONToDate() {
add_task(async function test_JSONToDate() {
function convert(aEntry, aTimezone="Europe/Berlin") {
let tzs = cal.getTimezoneService();
let calendarTz = tzs.getTimezone(aTimezone);
@ -715,9 +723,9 @@ add_task(function* test_JSONToDate() {
equal(convert({ dateTime: "2015-01-02T03:04:05+05:00" }), "20150102T030405 in Antarctica/Mawson");
});
add_task(function* test_organizerCN() {
add_task(async function test_organizerCN() {
gServer.events = [];
let client = yield gServer.getClient();
let client = await gServer.getClient();
equal(client.getProperty("organizerCN"), null);
gServer.resetClient(client);
@ -734,12 +742,12 @@ add_task(function* test_organizerCN() {
end: { dateTime: "2006-06-10T20:00:00+02:00" },
iCalUID: "go6ijb0b46hlpbu4eeu92njevo@google.com"
}];
client = yield gServer.getClient();
client = await gServer.getClient();
equal(client.getProperty("organizerCN"), gServer.creator.displayName);
gServer.resetClient(client);
});
add_task(function* test_always_readOnly() {
add_task(async function test_always_readOnly() {
gServer.events = [{
kind: "calendar#event",
etag: "\"2299601498276000\"",
@ -754,26 +762,26 @@ add_task(function* test_always_readOnly() {
iCalUID: "go6ijb0b46hlpbu4eeu92njevo@google.com"
}];
gServer.calendarListData.accessRole = "freeBusyReader";
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client);
ok(client.readOnly);
client.readOnly = false;
ok(client.readOnly);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 1);
notEqual(items[0].title, "New Event");
gServer.resetClient(client);
gServer.calendarListData.accessRole = "reader";
client = yield gServer.getClient();
client = await gServer.getClient();
ok(client.readOnly);
client.readOnly = false;
ok(client.readOnly);
gServer.resetClient(client);
});
add_task(function* test_reset_sync() {
add_task(async function test_reset_sync() {
gServer.tasks = [{
kind: "tasks#task",
id: "MTEyMDE2MDE5NzE0NjYzMDk4ODI6MDo0MDI1NDg2NjU",
@ -818,18 +826,18 @@ add_task(function* test_reset_sync() {
end: { dateTime: "2006-06-10T20:00:00+02:00" },
iCalUID: "fepf8uf6n7n04w7feukucs9n8e@google.com"
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let uncached = client.wrappedJSObject.mUncachedCalendar.wrappedJSObject;
let pclient = cal.async.promisifyCalendar(client);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 4);
notEqual(client.getProperty("syncToken.events"), "");
notEqual(client.getProperty("lastUpdated.tasks"), "");
yield uncached.resetSync();
items = yield pclient.getAllItems();
await uncached.resetSync();
items = await pclient.getAllItems();
equal(items.length, 0);
equal(client.getProperty("syncToken.events"), "");
@ -838,7 +846,7 @@ add_task(function* test_reset_sync() {
gServer.resetClient(client);
});
add_task(function* test_basicItems() {
add_task(async function test_basicItems() {
gServer.events = [{
kind: "calendar#event",
etag: "\"2299601498276000\"",
@ -902,10 +910,10 @@ add_task(function* test_basicItems() {
}]
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 2);
let event = cal.item.isEvent(items[0]) ? items[0] : items[1];
@ -964,8 +972,8 @@ add_task(function* test_basicItems() {
gServer.resetClient(client);
});
add_task(function* test_addModifyDeleteItem() {
let client = yield gServer.getClient();
add_task(async function test_addModifyDeleteItem() {
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
equal(gServer.events.length, 0);
equal(gServer.tasks.length, 0);
@ -1015,11 +1023,11 @@ add_task(function* test_addModifyDeleteItem() {
].join("\r\n"));
// Add an event
let addedEvent = yield pclient.adoptItem(event);
let addedEvent = await pclient.adoptItem(event);
notEqual(addedEvent.id, null);
equal(addedEvent.organizer.id, "mailto:xpcshell@example.com");
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 1);
equal(items[0].id, addedEvent.id);
equal(items[0].organizer.id, "mailto:xpcshell@example.com");
@ -1028,10 +1036,10 @@ add_task(function* test_addModifyDeleteItem() {
equal(gServer.tasks.length, 0);
// Add a task
let addedTask = yield pclient.adoptItem(task);
let addedTask = await pclient.adoptItem(task);
notEqual(addedTask.id, null);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 2);
equal(items[1].id, addedTask.id);
@ -1042,10 +1050,10 @@ add_task(function* test_addModifyDeleteItem() {
let newEvent = items[0].clone();
newEvent.title = "changed";
let modifiedEvent = yield pclient.modifyItem(newEvent, items[0]);
let modifiedEvent = await pclient.modifyItem(newEvent, items[0]);
equal(modifiedEvent.title, "changed");
notEqual(modifiedEvent.getProperty("LAST-MODIFIED"), addedEvent.getProperty("LAST-MODIFIED"));
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 2);
equal(items[0].title, "changed");
equal(items[0].id, addedEvent.id);
@ -1057,10 +1065,10 @@ add_task(function* test_addModifyDeleteItem() {
let newTask = items[1].clone();
newTask.title = "changed";
let modifiedTask = yield pclient.modifyItem(newTask, items[1]);
let modifiedTask = await pclient.modifyItem(newTask, items[1]);
equal(modifiedTask.title, "changed");
notEqual(modifiedTask.getProperty("LAST-MODIFIED"), addedTask.getProperty("LAST-MODIFIED"));
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 2);
equal(items[1].title, "changed");
equal(items[1].id, addedTask.id);
@ -1069,15 +1077,15 @@ add_task(function* test_addModifyDeleteItem() {
equal(gServer.tasks.length, 1);
// Delete an event
yield pclient.deleteItem(modifiedEvent);
items = yield pclient.getAllItems();
await pclient.deleteItem(modifiedEvent);
items = await pclient.getAllItems();
equal(items.length, 1);
equal(gServer.events.length, 0);
equal(gServer.tasks.length, 1);
// Delete a task
yield pclient.deleteItem(modifiedTask);
items = yield pclient.getAllItems();
await pclient.deleteItem(modifiedTask);
items = await pclient.getAllItems();
equal(items.length, 0);
equal(gServer.events.length, 0);
equal(gServer.tasks.length, 0);
@ -1085,8 +1093,8 @@ add_task(function* test_addModifyDeleteItem() {
gServer.resetClient(client);
});
add_task(function* test_recurring_event() {
let client = yield gServer.getClient();
add_task(async function test_recurring_event() {
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let event = cal.createEvent([
@ -1098,7 +1106,7 @@ add_task(function* test_recurring_event() {
"END:VEVENT"
].join("\r\n"));
event = yield pclient.addItem(event);
event = await pclient.addItem(event);
equal(gServer.events.length, 1);
equal(gServer.events[0].recurrence.length, 1);
equal(gServer.events[0].recurrence[0], "RRULE:FREQ=WEEKLY");
@ -1108,7 +1116,7 @@ add_task(function* test_recurring_event() {
changedOcc.title = "changed";
event.recurrenceInfo.modifyException(occ, true);
event = yield pclient.modifyItem(changedOcc, occ);
event = await pclient.modifyItem(changedOcc, occ);
occ = event.recurrenceInfo.getNextOccurrence(event.startDate);
equal(occ.title, "changed");
equal(gServer.events.length, 2);
@ -1116,7 +1124,7 @@ add_task(function* test_recurring_event() {
gServer.resetClient(client);
});
add_task(function* test_recurring_exception() {
add_task(async function test_recurring_exception() {
gServer.syncs = [{
token: "1",
events: [{
@ -1161,10 +1169,10 @@ add_task(function* test_recurring_exception() {
}]
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 1);
let exIds = items[0].recurrenceInfo.getExceptionIds({});
@ -1174,9 +1182,9 @@ add_task(function* test_recurring_exception() {
equal(ex.title, "New Event changed");
client.refresh();
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 1);
exIds = items[0].recurrenceInfo.getExceptionIds({});
@ -1185,7 +1193,7 @@ add_task(function* test_recurring_exception() {
gServer.resetClient(client);
});
add_task(function* test_recurring_cancelled_exception() {
add_task(async function test_recurring_cancelled_exception() {
gServer.syncs = [{
token: "1",
events: [{
@ -1203,18 +1211,18 @@ add_task(function* test_recurring_cancelled_exception() {
}]
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 0);
gServer.resetClient(client);
});
add_task(function* test_import_invitation() {
add_task(async function test_import_invitation() {
Preferences.set("calendar.google.enableAttendees", true);
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let event = cal.createEvent([
"BEGIN:VEVENT",
@ -1235,14 +1243,14 @@ add_task(function* test_import_invitation() {
"END:VEVENT"
].join("\r\n"));
let addedItem = yield pclient.adoptItem(event);
let addedItem = await pclient.adoptItem(event);
equal(gServer.events.length, 1);
equal(addedItem.icalString, event.icalString);
gServer.resetClient(client);
Preferences.set("calendar.google.enableAttendees", false);
});
add_task(function* test_modify_invitation() {
add_task(async function test_modify_invitation() {
Preferences.set("calendar.google.enableAttendees", true);
let organizer = {
displayName: "organizer name",
@ -1277,10 +1285,10 @@ add_task(function* test_modify_invitation() {
}];
// Case #1: User is attendee
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 1);
let item = items[0];
@ -1296,7 +1304,7 @@ add_task(function* test_modify_invitation() {
att.participationStatus = "ACCEPTED";
newItem.addAttendee(att);
yield pclient.modifyItem(newItem, items[0]);
await pclient.modifyItem(newItem, items[0]);
equal(gServer.lastMethod, "PATCH");
// Case #2: User is organizer
@ -1317,10 +1325,10 @@ add_task(function* test_modify_invitation() {
gServer.events[0].creator = gServer.creator;
gServer.events[0].attendees = [organizer, attendee];
client = yield gServer.getClient();
client = await gServer.getClient();
pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 1);
item = items[0];
@ -1336,13 +1344,13 @@ add_task(function* test_modify_invitation() {
org.participationStatus = "TENTATIVE";
newItem.addAttendee(org);
modifiedItem = yield pclient.modifyItem(newItem, items[0]);
modifiedItem = await pclient.modifyItem(newItem, items[0]);
equal(gServer.lastMethod, "PUT");
gServer.resetClient(client);
});
add_task(function* test_metadata() {
add_task(async function test_metadata() {
gServer.events = [{
kind: "calendar#event",
etag: "\"1\"",
@ -1366,12 +1374,12 @@ add_task(function* test_metadata() {
notes: "description"
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let offline = client.wrappedJSObject.mCachedCalendar;
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
// Check initial metadata
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
let meta = getAllMeta(offline);
let [event, task] = items;
ok(cal.item.isEvent(event));
@ -1384,9 +1392,9 @@ add_task(function* test_metadata() {
gServer.nextEtag = '"3"';
let newEvent = event.clone();
newEvent.title = "changed";
yield pclient.modifyItem(newEvent, event);
await pclient.modifyItem(newEvent, event);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
meta = getAllMeta(offline);
[event, task] = items;
ok(cal.item.isEvent(event));
@ -1399,9 +1407,9 @@ add_task(function* test_metadata() {
gServer.nextEtag = '"4"';
let newTask = task.clone();
newTask.title = "changed";
yield pclient.modifyItem(newTask, task);
await pclient.modifyItem(newTask, task);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
meta = getAllMeta(offline);
[event, task] = items;
equal(meta.size, 2);
@ -1409,19 +1417,19 @@ add_task(function* test_metadata() {
equal(meta.get(task.hashId), ['"4"', "MTEyMDE2MDE5NzE0NjYzMDk4ODI6MDo0MDI1NDg2NjU", false].join("\u001A"));
// Delete an event
yield pclient.deleteItem(event);
await pclient.deleteItem(event);
meta = getAllMeta(offline);
equal(meta.size, 1);
equal(meta.get(task.hashId), ['"4"', "MTEyMDE2MDE5NzE0NjYzMDk4ODI6MDo0MDI1NDg2NjU", false].join("\u001A"));
// Delete a task
yield pclient.deleteItem(task);
await pclient.deleteItem(task);
meta = getAllMeta(offline);
equal(meta.size, 0);
// Add an event
gServer.nextEtag = '"6"';
newEvent = yield pclient.addItem(event);
newEvent = await pclient.addItem(event);
meta = getAllMeta(offline);
equal(meta.size, 1);
equal(gServer.events.length, 1);
@ -1429,7 +1437,7 @@ add_task(function* test_metadata() {
// Add a task
gServer.nextEtag = '"7"';
newTask = yield pclient.addItem(task);
newTask = await pclient.addItem(task);
meta = getAllMeta(offline);
equal(meta.size, 2);
equal(gServer.events.length, 1);
@ -1440,7 +1448,7 @@ add_task(function* test_metadata() {
gServer.resetClient(client);
});
add_task(function* test_metadata_recurring() {
add_task(async function test_metadata_recurring() {
gServer.events = [{
kind: "calendar#event",
etag: "\"1\"",
@ -1476,10 +1484,10 @@ add_task(function* test_metadata_recurring() {
originalStartTime: { dateTime: "2006-06-17T18:00:00+02:00" }
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let offline = client.wrappedJSObject.mCachedCalendar;
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
let meta = getAllMeta(offline);
equal(meta.size, 3);
@ -1495,7 +1503,7 @@ add_task(function* test_metadata_recurring() {
let newEx = ex.clone();
newEx.title = "New Event changed again";
gServer.nextEtag = '"4"';
yield pclient.modifyItem(newEx, ex);
await pclient.modifyItem(newEx, ex);
meta = getAllMeta(offline);
equal(meta.size, 3);
equal(meta.get(newEx.hashId), ['"4"', "go6ijb0b46hlpbu4eeu92njevo_20060610T160000Z", false].join("\u001A"));
@ -1503,20 +1511,20 @@ add_task(function* test_metadata_recurring() {
// Deleting an exception should delete the metadata, as it turns into an EXDATE
let newItem = items[0].clone();
newItem.recurrenceInfo.removeOccurrenceAt(exIds[0]);
yield pclient.modifyItem(newItem, items[0]);
await pclient.modifyItem(newItem, items[0]);
meta = getAllMeta(offline);
equal(meta.size, 2);
// Deleting the master item should remove all metadata entries
yield pclient.deleteItem(items[0]);
await pclient.deleteItem(items[0]);
meta = getAllMeta(offline);
equal(meta.size, 0);
gServer.resetClient(client);
});
add_task(function* test_conflict_modify() {
add_task(async function test_conflict_modify() {
// TODO task/event conflicts are handled in the same way so I'm going to
// skip adding tests for tasks here, but it probably wouldn't hurt to
// create them at some point.
@ -1533,9 +1541,9 @@ add_task(function* test_conflict_modify() {
end: { dateTime: "2006-06-10T20:00:00+02:00" },
iCalUID: "go6ijb0b46hlpbu4eeu92njevo@google.com"
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let item = (yield pclient.getAllItems())[0];
let item = (await pclient.getAllItems())[0];
// Case #1: Modified on server, modify locally, overwrite conflict
MockConflictPrompt.overwrite = true;
@ -1543,8 +1551,8 @@ add_task(function* test_conflict_modify() {
newItem.title = "local change";
gServer.events[0].etag = '"2"';
gServer.events[0].summary = "remote change";
let modifiedItem = yield pclient.modifyItem(newItem, item);
item = (yield pclient.getAllItems())[0];
let modifiedItem = await pclient.modifyItem(newItem, item);
item = (await pclient.getAllItems())[0];
equal(gServer.events[0].summary, "local change");
notEqual(gServer.events[0].etag, '"2"');
equal(item.title, "local change");
@ -1556,7 +1564,7 @@ add_task(function* test_conflict_modify() {
gServer.events[0].etag = '"3"';
gServer.events[0].summary = "remote change";
try {
modifiedItem = yield pclient.modifyItem(newItem, item);
modifiedItem = await pclient.modifyItem(newItem, item);
do_throw("Expected modifyItem to be cancelled");
} catch (e) {
// Swallow cancelling the request
@ -1565,9 +1573,9 @@ add_task(function* test_conflict_modify() {
}
}
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
item = (yield pclient.getAllItems())[0];
item = (await pclient.getAllItems())[0];
equal(gServer.events[0].summary, "remote change");
equal(gServer.events[0].etag, '"3"');
equal(item.title, "remote change");
@ -1577,7 +1585,7 @@ add_task(function* test_conflict_modify() {
gServer.events[0].etag = '"4"';
gServer.events[0].summary = "remote change";
try {
yield pclient.deleteItem(item);
await pclient.deleteItem(item);
do_throw("Expected deleteItem to be cancelled");
} catch (e) {
// Swallow cancelling the request
@ -1586,9 +1594,9 @@ add_task(function* test_conflict_modify() {
}
}
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
item = (yield pclient.getAllItems())[0];
item = (await pclient.getAllItems())[0];
equal(gServer.events[0].summary, "remote change");
equal(gServer.events[0].etag, '"4"');
equal(item.title, "remote change");
@ -1597,14 +1605,14 @@ add_task(function* test_conflict_modify() {
MockConflictPrompt.overwrite = true;
gServer.events[0].etag = '"5"';
gServer.events[0].summary = "remote change";
yield pclient.deleteItem(item);
item = (yield pclient.getAllItems())[0];
await pclient.deleteItem(item);
item = (await pclient.getAllItems())[0];
equal(gServer.events.length, 0);
gServer.resetClient(client);
});
add_task(function* test_conflict_delete() {
add_task(async function test_conflict_delete() {
// TODO task/event conflicts are handled in the same way so I'm going to
// skip adding tests for tasks here, but it probably wouldn't hurt to
// create them at some point.
@ -1624,17 +1632,17 @@ add_task(function* test_conflict_delete() {
// Load intial event to server
gServer.events = [coreEvent];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
let item = (yield pclient.getAllItems())[0];
let item = (await pclient.getAllItems())[0];
// Case #1: Deleted on server, modify locally, overwrite conflict
MockConflictPrompt.overwrite = true;
gServer.events = [];
let newItem = item.clone();
newItem.title = "local change";
let modifiedItem = yield pclient.modifyItem(newItem, item);
item = (yield pclient.getAllItems())[0];
let modifiedItem = await pclient.modifyItem(newItem, item);
item = (await pclient.getAllItems())[0];
equal(gServer.events[0].summary, "local change");
notEqual(gServer.events[0].etag, '"2"');
equal(item.title, "local change");
@ -1645,7 +1653,7 @@ add_task(function* test_conflict_delete() {
MockConflictPrompt.overwrite = false;
gServer.events = [];
try {
modifiedItem = yield pclient.modifyItem(newItem, item);
modifiedItem = await pclient.modifyItem(newItem, item);
do_throw("Expected modifyItem to be cancelled");
} catch (e) {
// Swallow cancelling the request
@ -1657,24 +1665,24 @@ add_task(function* test_conflict_delete() {
coreEvent.status = "cancelled";
gServer.events = [coreEvent];
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 0);
equal(gServer.events.length, 1);
// Put the event back in the calendar for the next run
delete gServer.events[0].status;
client.refresh();
yield gServer.waitForLoad(client);
items = yield pclient.getAllItems();
await gServer.waitForLoad(client);
items = await pclient.getAllItems();
equal(items.length, 1);
// Case #3: Deleted on server, delete locally, don't overwrite conflict
MockConflictPrompt.overwrite = false;
gServer.events = [];
try {
yield pclient.deleteItem(item);
await pclient.deleteItem(item);
do_throw("Expected deleteItem to be cancelled");
} catch (e) {
// Swallow cancelling the request
@ -1685,29 +1693,29 @@ add_task(function* test_conflict_delete() {
// The next synchronize should cause the event to be deleted locally.
coreEvent.status = "cancelled";
gServer.events = [coreEvent];
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 0);
// Put the event back in the calendar for the next run
delete gServer.events[0].status;
client.refresh();
yield gServer.waitForLoad(client);
items = yield pclient.getAllItems();
await gServer.waitForLoad(client);
items = await pclient.getAllItems();
equal(items.length, 1);
// Case #4: Deleted on server, delete locally, overwrite conflict
MockConflictPrompt.overwrite = true;
gServer.events = [];
yield pclient.deleteItem(item);
items = yield pclient.getAllItems();
await pclient.deleteItem(item);
items = await pclient.getAllItems();
equal(items.length, 0);
gServer.resetClient(client);
});
add_task(function* test_default_alarms() {
add_task(async function test_default_alarms() {
let defaultReminders = [
{ method: "popup", minutes: 10 },
{ method: "email", minutes: 20 },
@ -1730,11 +1738,11 @@ add_task(function* test_default_alarms() {
}];
// Case #1: read default alarms from event stream
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
equal(client.getProperty("settings.defaultReminders"), JSON.stringify(defaultReminders));
let item = (yield pclient.getAllItems())[0];
let item = (await pclient.getAllItems())[0];
let alarms = item.getAlarms({});
equal(alarms.length, 2);
@ -1759,7 +1767,7 @@ add_task(function* test_default_alarms() {
"END:VEVENT"
].join("\r\n"));
yield pclient.addItem(event);
await pclient.addItem(event);
ok(gServer.events[1].reminders.useDefault);
equal(gServer.events[1].reminders.overrides.length, 0);
@ -1783,7 +1791,7 @@ add_task(function* test_default_alarms() {
"END:VEVENT"
].join("\r\n"));
yield pclient.addItem(event);
await pclient.addItem(event);
ok(gServer.events[2].reminders.useDefault);
equal(gServer.events[2].reminders.overrides.length, 1);
equal(gServer.events[2].reminders.overrides[0].minutes, 5);
@ -1793,7 +1801,7 @@ add_task(function* test_default_alarms() {
// Case #4a: Empty default alarms
gServer.calendarListData.defaultReminders = [];
gServer.eventsData.defaultReminders = [];
client = yield gServer.getClient();
client = await gServer.getClient();
pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
event = cal.createEvent([
@ -1805,7 +1813,7 @@ add_task(function* test_default_alarms() {
"END:VEVENT"
].join("\r\n"));
yield pclient.addItem(event);
await pclient.addItem(event);
ok(gServer.events[0].reminders.useDefault);
equal(gServer.events[0].reminders.overrides, undefined);
@ -1814,16 +1822,16 @@ add_task(function* test_default_alarms() {
// Case #4b: Read an item with empty default alarms
gServer.events = events;
client = yield gServer.getClient();
client = await gServer.getClient();
pclient = cal.async.promisifyCalendar(client.wrappedJSObject);
item = (yield pclient.getAllItems())[0];
item = (await pclient.getAllItems())[0];
equal(item.getProperty("X-DEFAULT-ALARM"), "TRUE");
gServer.resetClient(client);
});
add_task(function* test_paginate() {
add_task(async function test_paginate() {
gServer.events = [{
kind: "calendar#event",
etag: "\"1\"",
@ -1872,7 +1880,7 @@ add_task(function* test_paginate() {
Preferences.set("calendar.google.maxResultsPerRequest", 1);
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client);
// Make sure all pages were requested
@ -1881,7 +1889,7 @@ add_task(function* test_paginate() {
// ...and we have all items. Not checking props
// because the other tests do this sufficiently.
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 4);
equal(client.getProperty("syncToken.events"), "next-sync-token");
@ -1890,7 +1898,7 @@ add_task(function* test_paginate() {
gServer.resetClient(client);
});
add_task(function* test_incremental_reset() {
add_task(async function test_incremental_reset() {
gServer.syncs = [{
token: "1",
events: [{
@ -1925,17 +1933,17 @@ add_task(function* test_incremental_reset() {
iCalUID: "fepf8uf6n7n04w7feukucs9n8e@google.com"
}]
}];
let client = yield gServer.getClient();
let client = await gServer.getClient();
let pclient = cal.async.promisifyCalendar(client);
let items = yield pclient.getAllItems();
let items = await pclient.getAllItems();
equal(items.length, 1);
equal(items[0].title, "New Event");
client.refresh();
yield gServer.waitForLoad(client);
await gServer.waitForLoad(client);
items = yield pclient.getAllItems();
items = await pclient.getAllItems();
equal(items.length, 1);
equal(items[0].title, "New Event 2");

Просмотреть файл

@ -29,8 +29,8 @@
[test_email_utils.js]
[test_freebusy.js]
[test_freebusy_service.js]
#[test_gdata_provider.js]
#requesttimeoutfactor = 2
[test_gdata_provider.js]
requesttimeoutfactor = 2
[test_hashedarray.js]
[test_ics.js]
[test_ics_parser.js]

Просмотреть файл

@ -21,7 +21,8 @@ DIRS += ['/%s' % CONFIG['MOZ_BRANDING_DIRECTORY']]
if CONFIG['MOZ_CALENDAR']:
DIRS += [
'/%s/calendar/lightning' % CONFIG['commreltopsrcdir'],
'/%s/calendar/timezones' % CONFIG['commreltopsrcdir']
'/%s/calendar/providers/gdata' % CONFIG['commreltopsrcdir'],
'/%s/calendar/timezones' % CONFIG['commreltopsrcdir'],
]
DIRS += [

Просмотреть файл

@ -61,5 +61,6 @@ stage-mozmill: make-stage-dir
stage-calendar: make-stage-dir
$(MAKE) -C $(commtopobjdir)/calendar/lightning stage-package
$(MAKE) -C $(commtopobjdir)/calendar/providers/gdata stage-package
.PHONY: stage-mozmill stage-calendar

Просмотреть файл

@ -71,6 +71,9 @@ xpcshell:
by-test-platform:
windows.*: true
default: false
fetches:
build:
- gdata-provider.en-US.xpi
mozmill:
description: "mozmill test run"