VulpesOS/gaia/apps/email/test/marionette/lib/email_sync.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

44 lines
1.1 KiB
JavaScript
Executable file

'use strict';
/*jshint node: true, browser: true */
var SHARED_PATH = __dirname + '/../../../../../shared/test/integration';
function EmailSync(client) {
this.client = client;
}
module.exports = EmailSync;
EmailSync.prototype = {
/**
* Call this in the setup() for the test.
*/
setup: function() {
this.client.contentScript.inject(
SHARED_PATH + '/mock_navigator_moz_set_message_handler.js'
);
this.client.contentScript.inject(
SHARED_PATH + '/mock_navigator_mozalarms.js'
);
},
/**
* Does the work to trigger a sync using helpers in
* mock_navigator_moz_set_message_handler.js.
*/
triggerSync: function() {
// trigger sync in Email App
this.client.executeScript(function() {
var interval = 1000;
var date = new Date(Date.now() + interval).getTime();
var alarm = {
data: {
type: 'sync',
accountIds: ['0', '1'],
interval: interval,
timestamp: date
}
};
return window.wrappedJSObject.fireMessageHandler(alarm, 'alarm');
});
}
};