Skip to content
Browse files

time-based checkpoint

  • Loading branch information...
1 parent 653ff04 commit 65069bb364f8f64fa7ec7806f57466678bc5f0fe @asutherland asutherland committed May 23, 2013
View
25 .gitignore
@@ -1,13 +1,14 @@
-data/deps/
-node-transformed-deps/
-jetpack-tcp-imap-demo.xpi
-gaia-email-opt.js
-gaia-symlink
-b2g-bindir-symlink
-b2g-builddir-symlink
-b2g-srcdir-symlink
-arbpl-dir-symlink
-test-profile
-test-logs
-fake-imap-server-profile
+/data/deps/
+/node-transformed-deps/
+/jetpack-tcp-imap-demo.xpi
+/gaia-email-opt.js
+/gaia-symlink
+/b2g-bindir-symlink
+/b2g-builddir-symlink
+/b2g-srcdir-symlink
+/arbpl-dir-symlink
+/test-profile
+/test-logs
+/fake-imap-server-profile
+/fake-activesync-server-profile
*~
View
8 data/lib/mailapi/accountcommon.js
@@ -64,7 +64,7 @@ var autoconfigByDomain = exports._autoconfigByDomain = {
username: '%EMAILLOCALPART%',
},
},
- 'fakehost': {
+ 'fakeimaphost': {
type: 'imap+smtp',
incoming: {
hostname: 'localhost',
@@ -94,12 +94,12 @@ var autoconfigByDomain = exports._autoconfigByDomain = {
username: '%EMAILLOCALPART%',
},
},
- 'aslocalhost': {
+ 'fakeashost': {
type: 'activesync',
displayName: 'Test',
incoming: {
- // This string may be clobbered with the correct port number when
- // running as a unit test.
+ // This string will be clobbered with the correct port number when running
+ // as a unit test.
server: 'http://localhost:8880',
username: '%EMAILADDRESS%',
},
View
51 data/lib/mailapi/worker-support/testhelper-main.js
@@ -59,28 +59,31 @@ var testHelper = {
* Support testAccount.getMessageBodyWithReps
*/
else if (cmd === 'runWithBody') {
-console.log('func source:', args.func);
-try {
- var func;
- eval('func = ' + args.func + ';');
- console.warn('FUNC', func);
- gMailAPI._getBodyForMessage(
- { id: args.headerId, date: args.headerDate },
- null,
- function(body) {
- console.log('got body, invoking func!');
- try {
- func(args.arg, body, function(results) {
- testHelper.sendMessage(uid, cmd, [results]);
- body.die();
- });
- }
- catch (ex) {
- console.error('problem in runWithBody func', ex, '\n', ex.stack);
- }
- });
-} catch (ex) { console.error('problem with runWithBody', ex, '\n', ex.stack); }
+ try {
+ var func;
+ eval('func = ' + args.func + ';');
+ gMailAPI._getBodyForMessage(
+ { id: args.headerId, date: args.headerDate },
+ null,
+ function(body) {
+ console.log('got body, invoking func!');
+ try {
+ func(args.arg, body, function(results) {
+ testHelper.sendMessage(uid, cmd, [results]);
+ body.die();
+ });
+ }
+ catch (ex) {
+ console.error('problem in runWithBody func', ex, '\n', ex.stack);
+ }
+ });
+ } catch (ex) {
+ console.error('problem with runWithBody', ex, '\n', ex.stack);
+ }
}
+ /**
+ * Support testUniverse.help_checkDatabaseDoesNotContain
+ */
else if (cmd === 'checkDatabaseDoesNotContain') {
var tablesAndKeyPrefixes = args;
var idb = $maildb._debugDB._db,
@@ -119,6 +122,12 @@ try {
};
});
}
+ /**
+ * Support fake-server stand-up.
+ */
+ else if (cmd === 'startFakeServer') {
+
+ }
}
};
$router.register(testHelper);
View
9 data/lib/rdcommon/testcontext.js
@@ -580,6 +580,15 @@ exports.defineTestsFor = function defineTestsFor(testModule, logfabs,
logfabs.push(logfab);
}
}
+ // transitively traverse/(idempotent) merge testhelpers; works because
+ // we're adding stuff to the outer loop as we go and length is not cached
+ if ('TESTHELPER_DEPS' in testHelper) {
+ for (var iSub = 0; iSub < testHelper.TESTHELPER_DEPS.length; iSub++) {
+ var subHelper = testHelper.TESTHELPER_DEPS[iSub];
+ if (testHelpers.indexOf(subHelper) === -1)
+ testHelpers.push(subHelper);
+ }
+ }
}
console.log("defining tests for", testModule.id);
return new TestDefiner(testModule.id, logfabs, testHelpers, tags);
View
159 test-runner/chrome/content/fake-server-support.js
@@ -1,24 +1,49 @@
/**
- * Support for loading Thunderbird-derived IMAP and SMTP fake-servers.
- * ActiveSync's fake-server has nothing to do with this file right now. Were we
- * ever to support NNTP (scope creep for now) or POP3 (boo, hiss!), Thunderbird
- * has those too.
+ * Support for loading Thunderbird-derived IMAP and SMTP fake-servers as well
+ * as our ActiveSync fake-server. Thunderbird has NNTP and POP3 that we could
+ * steal too.
*
* Thunderbird's fake-servers are primarily used to being executed in an
* xpcshell "global soup" type of context. load(path) loads things in the
* current (global) context a la the subscript loader. (They've also been used
* in TB's mozmill tests a little somehow.) To this end, we create a sandbox
* to load them in.
*
- * These servers are intended to be used in one of two primary modes:
- * - In unit tests in the same process.
+ * These servers are intended to be used in one of three primary modes:
+ * - In unit tests in the same process, such as our GELAM tests. In this case,
+ * the unit test is in complete control of what folders are created. Note
+ * that our unit tests run from a worker thread, but the fake-servers run in
+ * the main thread (with chrome privileges.)
+ *
* - In integration tests where the e-mail app is running in a b2g-desktop
- * instance or on a real device and is being controlled by marionette and
- * the fake-server is in a different xulrunner-ish process
+ * instance or on a real device and is being controlled by marionette. In
+ * this case, we are expecting to be running inside an xpcwindow xpcshell
+ * instance and the test is in control of what folders are created. In this
+ * case, the unit test is running with chrome privileges in the main thread,
+ * just like the fake servers.
+ *
+ * - As standalone servers initiated by GELAM's Makefile. Eventually we will
+ * automatically put some messages in to make the accounts more interesting,
+ * but not yet. The fake servers are run using our GELAM unit test harness.
+ *
+ * === Communication and control ===
+ *
+ * If our unit tests are running against a real IMAP server, our manipulation
+ * of the server must be asynchronous since we are reusing the e-mail app's
+ * own implementation (like APPEND) and there's no way we could do any evil
+ * tricks to make things seem synchronous. This means that all of our test APIs
+ * for manipulating servers are async.
*
- * ===
+ * However, for our fake-servers, we can do things somewhat synchronously.
+ *
+ * For our unit tests, changes to the fake-servers are issued via synchronous
+ * XHR requests to 'backdoor' JSON-over-HTTP servers from the worker thread
+ * where the back-end and our unit tests run. If run in the same thread, we
+ * could bypass the HTTP thing.
+ *
+ *
+ * === Overview of fake server files we use ===
*
- * Overview of fake server files we use:
* - maild.js: nsMailServer does all the network stuff, takes a handle-creator
* to invoke when a connection is received and a daemon to pass to it.
*
@@ -39,8 +64,6 @@ var Cu = Components.utils;
var fu = {};
Cu.import('resource://gre/modules/FileUtils.jsm', fu);
-var baseFakeserver = '';
-
// -- create a sandbox
// We could use a scoped subscript load, but keeping the fake-servers in their
// own compartment makes it easier to track their memory usage and to kill
@@ -83,56 +106,65 @@ function synchronousReadFile(nsfile) {
return data;
}
-function loadInSandbox(relpath, sandbox) {
- // XXX parameterize on inGELAM
- relpath = ['test-runner', 'chrome', 'fakeserver'].concat(relpath);
+
+function loadInSandbox(base, relpath, sandbox) {
+ relpath = base.concat(relpath);
var nsfile = fu.FileUtils.getFile('CurWorkD', relpath);
- console.log('loadInSandbox resolved', relpath, 'to', nsfile.path);
+ //console.log('loadInSandbox resolved', relpath, 'to', nsfile.path);
var jsstr = synchronousReadFile(nsfile);
// the moz idiom is that synchronous file loading is okay for unit test
// situations like this. xpcshell load or even normal Cu.import would sync
// load.
Cu.evalInSandbox(jsstr, sandbox, '1.8', nsfile.path);
}
-var httpdSandbox = null;
-function createHttpdSandbox() {
- if (httpdSandbox)
- return;
-
- httpdSandbox = makeSandbox('imap-backdoor');
-
- // for back-door control
- loadInSandbox(['subscript', 'httpd.js'], httpdSandbox);
-}
-
var imapSandbox = null;
+var baseFakeserver = ['test-runner', 'chrome', 'fakeserver'];
function createImapSandbox() {
if (imapSandbox)
return;
imapSandbox = makeSandbox('imap-fakeserver');
// all the fakeserver stuff
- loadInSandbox(['subscript', 'maild.js'], imapSandbox);
- loadInSandbox(['subscript', 'auth.js'], imapSandbox);
- loadInSandbox(['subscript', 'imapd.js'], imapSandbox);
- loadInSandbox(['subscript', 'smtpd.js'], imapSandbox);
+ loadInSandbox(baseFakeserver, ['subscript', 'maild.js'], imapSandbox);
+ loadInSandbox(baseFakeserver, ['subscript', 'auth.js'], imapSandbox);
+ loadInSandbox(baseFakeserver, ['subscript', 'imapd.js'], imapSandbox);
+ loadInSandbox(baseFakeserver, ['subscript', 'smtpd.js'], imapSandbox);
}
var activesyncSandbox = null;
+var baseActiveSync = ['deps', 'activesync'];
+var codepages = ['AirSyncBase.js', 'AirSync.js', 'Calendar.js', 'Common.js',
+ 'ComposeMail.js', 'Contacts2.js', 'Contacts.js',
+ 'DocumentLibrary.js', 'Email2.js', 'Email.js',
+ 'FolderHierarchy.js', 'GAL.js', 'ItemEstimate.js',
+ 'ItemOperations.js', 'MeetingResponse.js', 'Move.js',
+ 'Notes.js', 'Ping.js', 'Provision.js', 'ResolveRecipients.js',
+ 'RightsManagement.js', 'Search.js', 'Settings.js', 'Tasks.js',
+ 'ValidateCert.js'];
function createActiveSyncSandbox() {
if (activesyncSandbox)
return;
activesyncSandbox = makeSandbox('activesync-fakeserver');
- // for the backdoor
- loadInSandbox('subscript/httpd.js', activesyncSandbox);
-
// load wbxml and all the codepages.
+ if (inGELAM) {
+ loadInSandbox(baseActiveSync, ['wbxml', 'wbxml.js'], activesyncSandbox);
+
+ for (var i = 0; i < codepages.length; i++) {
+ loadInSandbox(baseActiveSync, ['codepages', codepages[i]],
+ activesyncSandbox);
+ }
+ loadInSandbox(baseActiveSync, ['codepages.js'], activesyncSandbox);
+ }
+ else {
+ throw new Error("XXX implement using aggregate JS file!");
+ }
// the actual activesync server logic
- loadInSandbox('subscript/activesync_server.js', activesyncSandbox);
+ loadInSandbox(baseFakeserver, ['subscript', 'activesync_server.js'],
+ activesyncSandbox);
}
/**
@@ -195,9 +227,64 @@ function makeSMTPServer(creds) {
};
}
+function makeActiveSyncServer(creds, logToDump) {
+ createActiveSyncSandbox();
+ var server = new activesyncSandbox.ActiveSyncServer();
+ server.start(0);
+
+ var httpServer = server.server;
+ var port = httpServer._socket.port;
+ httpServer._port = port;
+ // it had created the identity on port 0, which is not helpful to anyone
+ httpServer._identity._initialize(port, httpServer._host, true);
+
+ if (logToDump) {
+ server.logRequest = function(request, body) {
+ let path = request.path;
+ if (request.queryString)
+ path += '?' + request.queryString;
+ dump('>>> ' + path + '\n');
+ if (body) {
+ if (body instanceof activesyncSandbox.WBXML.Reader) {
+ dump(body.dump());
+ body.rewind();
+ }
+ else {
+ dump(JSON.stringify(body, null, 2) + '\n');
+ }
+ }
+ dump('\n');
+ };
+
+ server.logResponse = function(request, response, body) {
+ dump('<<<\n');
+ if (body) {
+ if (body instanceof activesyncSandbox.WBXML.Writer) {
+ dump(new activesyncSandbox.WBXML.Reader(
+ body, activesyncSandbox.ActiveSyncCodepages).dump());
+ }
+ else {
+ dump(JSON.stringify(body, null, 2) + '\n');
+ }
+ }
+ dump('\n');
+ };
+
+ server.logResponseError = function(err) {
+ dump("ERR " + err + '\n\n');
+ };
+ }
+
+ return {
+ server: server,
+ port: port
+ };
+}
+
return {
makeIMAPServer: makeIMAPServer,
- makeSMTPServer: makeSMTPServer
+ makeSMTPServer: makeSMTPServer,
+ makeActiveSyncServer: makeActiveSyncServer
};
} catch (ex) {
console.error('Problem initializing FakeServerSupport', ex, '\n',
View
14 test-runner/chrome/content/loggest-chrome-runner.js
@@ -814,7 +814,7 @@ function _runTestFile(testFileName, variant, thoroughCleanup) {
case 'imap:fake':
testParams = {
name: 'Baron von Testendude',
- emailAddress: 'testy@fakehost',
+ emailAddress: 'testy@fakeimaphost',
password: 'testy',
slow: false,
type: 'imap',
@@ -825,7 +825,7 @@ function _runTestFile(testFileName, variant, thoroughCleanup) {
case 'activesync:fake':
testParams = {
name: 'Baron von Testendude',
- emailAddress: 'testy@fakehost',
+ emailAddress: 'testy@fakeashost',
password: 'testy',
slow: false,
type: 'activesync',
@@ -1096,6 +1096,16 @@ function DOMLoaded() {
break;
case 'activesync-fake-server':
+ try {
+ window.activesyncServer = FakeServerSupport.makeActiveSyncServer(
+ { username: 'testy', password: 'testy' });
+ }
+ catch (ex) {
+ console.error('Problem spinning up ActiveSync server', ex, '\n',
+ ex.stack);
+ }
+ console.log('ActiveSync server up on port',
+ window.activesyncServer.port);
break;
}
return;
View
0 ...nner/chrome/fakeserver/subscript/httpd.js → ...runner/chrome/fakeserver/modules/httpd.js
File renamed without changes.
View
70 test-runner/chrome/fakeserver/subscript/activesync_server.js
@@ -1,6 +1,6 @@
'use strict';
-Components.utils.import('resource://testing-common/httpd.js');
+Components.utils.import('resource://fakeserver/modules/httpd.js');
Components.utils.import('resource://gre/modules/NetUtil.jsm');
/**
@@ -40,7 +40,7 @@ function decodeWBXML(stream) {
for (let i = 0; i < str.length; i++)
bytes[i] = str.charCodeAt(i);
- return new $_wbxml.Reader(bytes, $_ascp);
+ return new WBXML.Reader(bytes, ActiveSyncCodepages);
}
/**
@@ -55,7 +55,7 @@ function decodeWBXML(stream) {
function ActiveSyncFolder(server, name, type, parentId) {
this.server = server;
this.name = name;
- this.type = type || $_ascp.FolderHierarchy.Enums.Type.Mail;
+ this.type = type || ActiveSyncCodepages.FolderHierarchy.Enums.Type.Mail;
this.id = 'folder-' + (this.server._nextCollectionId++);
this.parentId = parentId || '0';
@@ -81,7 +81,7 @@ ActiveSyncFolder.prototype = {
* @return true if the message is in the filter range, false otherwise
*/
_messageInFilterRange: function(filterType, message) {
- return filterType === $_ascp.AirSync.Enums.FilterType.NoFilter ||
+ return filterType === ActiveSyncCodepages.AirSync.Enums.FilterType.NoFilter ||
(this.server._clock - this.filterTypeToMS[filterType] <=
message.date);
},
@@ -333,7 +333,7 @@ function ActiveSyncServer(startDate) {
// TODO: get the date from the test helper somehow...
this._clock = Date.now();
- const folderType = $_ascp.FolderHierarchy.Enums.Type;
+ const folderType = ActiveSyncCodepages.FolderHierarchy.Enums.Type;
this._folders = [];
this.foldersByType = {
inbox: [],
@@ -509,12 +509,12 @@ ActiveSyncServer.prototype = {
* @param requestData the WBXML.Reader for the request
*/
_handleCommand_FolderSync: function(requestData) {
- const fh = $_ascp.FolderHierarchy.Tags;
- const folderType = $_ascp.FolderHierarchy.Enums.Type;
+ const fh = ActiveSyncCodepages.FolderHierarchy.Tags;
+ const folderType = ActiveSyncCodepages.FolderHierarchy.Enums.Type;
let syncKey;
- let e = new $_wbxml.EventParser();
+ let e = new WBXML.EventParser();
e.addEventListener([fh.FolderSync, fh.SyncKey], function(node) {
syncKey = node.children[0].textContent;
});
@@ -523,7 +523,7 @@ ActiveSyncServer.prototype = {
let nextSyncKey = 'folders-' + (this._nextFolderSyncId++);
this._folderSyncStates[nextSyncKey] = [];
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(fh.FolderSync)
.tag(fh.Status, '1')
.tag(fh.SyncKey, nextSyncKey)
@@ -584,9 +584,9 @@ ActiveSyncServer.prototype = {
if (!requestData)
requestData = this._cachedSyncRequest;
- const as = $_ascp.AirSync.Tags;
- const asb = $_ascp.AirSyncBase.Tags;
- const asEnum = $_ascp.AirSync.Enums;
+ const as = ActiveSyncCodepages.AirSync.Tags;
+ const asb = ActiveSyncCodepages.AirSyncBase.Tags;
+ const asEnum = ActiveSyncCodepages.AirSync.Enums;
let syncKey, collectionId, getChanges,
server = this,
@@ -595,7 +595,7 @@ ActiveSyncServer.prototype = {
truncationSize = 0,
clientCommands = [];
- let e = new $_wbxml.EventParser();
+ let e = new WBXML.EventParser();
const base = [as.Sync, as.Collections, as.Collection];
e.addEventListener(base.concat(as.SyncKey), function(node) {
@@ -660,7 +660,7 @@ ActiveSyncServer.prototype = {
if (syncKey === '0') {
// Initial sync can't change anything, in either direction.
if (getChanges || clientCommands.length) {
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(as.Sync)
.tag(as.Status, asEnum.Status.ProtocolError)
.etag();
@@ -727,14 +727,14 @@ ActiveSyncServer.prototype = {
}
// - A sync without changes requested and no commands to run -> error!
else {
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(as.Sync)
.tag(as.Status, asEnum.Status.ProtocolError)
.etag();
return w;
}
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(as.Sync)
.stag(as.Collections)
@@ -812,13 +812,13 @@ ActiveSyncServer.prototype = {
* @param requestData the WBXML.Reader for the request
*/
_handleCommand_ItemOperations: function(requestData) {
- const io = $_ascp.ItemOperations.Tags;
- const as = $_ascp.AirSync.Tags;
- const asb = $_ascp.AirSyncBase.Tags;
+ const io = ActiveSyncCodepages.ItemOperations.Tags;
+ const as = ActiveSyncCodepages.AirSync.Tags;
+ const asb = ActiveSyncCodepages.AirSyncBase.Tags;
let fetches = [];
- let e = new $_wbxml.EventParser();
+ let e = new WBXML.EventParser();
e.addEventListener([io.ItemOperations, io.Fetch], function(node) {
let fetch = {};
@@ -840,7 +840,7 @@ ActiveSyncServer.prototype = {
});
e.run(requestData);
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(io.ItemOperations)
.tag(io.Status, '1')
.stag(io.Response);
@@ -892,14 +892,14 @@ ActiveSyncServer.prototype = {
* @param requestData the WBXML.Reader for the request
*/
_handleCommand_GetItemEstimate: function(requestData) {
- const ie = $_ascp.ItemEstimate.Tags;
- const as = $_ascp.AirSync.Tags;
- const ieStatus = $_ascp.ItemEstimate.Enums.Status;
+ const ie = ActiveSyncCodepages.ItemEstimate.Tags;
+ const as = ActiveSyncCodepages.AirSync.Tags;
+ const ieStatus = ActiveSyncCodepages.ItemEstimate.Enums.Status;
let syncKey, collectionId;
let server = this;
- let e = new $_wbxml.EventParser();
+ let e = new WBXML.EventParser();
e.addEventListener([ie.GetItemEstimate, ie.Collections, ie.Collection],
function(node) {
for (let child of node.children) {
@@ -928,7 +928,7 @@ ActiveSyncServer.prototype = {
estimate = folder.numCommandsForSyncState(syncKey);
}
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(ie.GetItemEstimate)
.stag(ie.Response)
.tag(ie.Status, status);
@@ -953,11 +953,11 @@ ActiveSyncServer.prototype = {
* @param requestData the WBXML.Reader for the request
*/
_handleCommand_MoveItems: function(requestData) {
- const mo = $_ascp.Move.Tags;
- const moStatus = $_ascp.Move.Enums.Status;
+ const mo = ActiveSyncCodepages.Move.Tags;
+ const moStatus = ActiveSyncCodepages.Move.Enums.Status;
let moves = [];
- let e = new $_wbxml.EventParser();
+ let e = new WBXML.EventParser();
e.addEventListener([mo.MoveItems, mo.Move], function(node) {
let move = {};
@@ -981,7 +981,7 @@ ActiveSyncServer.prototype = {
});
e.run(requestData);
- let w = new $_wbxml.Writer('1.3', 1, 'UTF-8');
+ let w = new WBXML.Writer('1.3', 1, 'UTF-8');
w.stag(mo.MoveItems);
for (let move of moves) {
@@ -1062,9 +1062,9 @@ ActiveSyncServer.prototype = {
* no truncation)
*/
_writeEmail: function(w, folder, message, truncSize) {
- const em = $_ascp.Email.Tags;
- const asb = $_ascp.AirSyncBase.Tags;
- const asbEnum = $_ascp.AirSyncBase.Enums;
+ const em = ActiveSyncCodepages.Email.Tags;
+ const asb = ActiveSyncCodepages.AirSyncBase.Tags;
+ const asbEnum = ActiveSyncCodepages.AirSyncBase.Enums;
// TODO: make this match the requested type
let bodyType = message.body.contentType === 'text/html' ?
@@ -1129,7 +1129,7 @@ ActiveSyncServer.prototype = {
* @return an object enumerating the changes requested
*/
_parseEmailChange: function(node) {
- const em = $_ascp.Email.Tags;
+ const em = ActiveSyncCodepages.Email.Tags;
let changes = {};
for (let child of node.children) {
@@ -1183,7 +1183,7 @@ ActiveSyncServer.prototype = {
_backdoor_addFolder: function(data) {
// XXX: Come up with a smarter way to preserve folder types when deleting
// and recreating them!
- const folderType = $_ascp.FolderHierarchy.Enums.Type;
+ const folderType = ActiveSyncCodepages.FolderHierarchy.Enums.Type;
let type = data.type;
if (!type) {
if (data.name === 'Inbox')
View
6 test/unit/resources/th_activesync_server.js → ...it/resources/th_fake_activesync_server.js
@@ -28,10 +28,12 @@ var TestActiveSyncServerMixins = {
__constructor: function(self, opts) {
if (!opts.universe)
throw new Error('You need to provide a universe!');
- self.T.convenienceSetup(self, 'created, listening to get port',
+ self.T.convenienceSetup('creating fake', self,
function() {
+
+
self.serverBaseUrl = 'http://localhost:8880';
- $accountcommon._autoconfigByDomain['aslocalhost'].incoming.server =
+ $accountcommon._autoconfigByDomain['fakeashost'].incoming.server =
self.serverBaseUrl;
});
self.T.convenienceDeferredCleanup(self, 'cleans up', function() {
View
4 test/unit/resources/th_imap_server.js → test/unit/resources/th_fake_imap_server.js
@@ -31,8 +31,8 @@ var TestIMAPServerMixins = {
self.T.convenienceSetup(self, 'created, listening to get port',
function() {
self.serverBaseUrl = 'http://localhost:8880';
- $accountcommon._autoconfigByDomain['aslocalhost'].incoming.server =
- self.serverBaseUrl;
+ var configEntry = $accountcommon._autoconfigByDomain['fakeimaphost'];
+ configEntry.incoming.port = self.serverBaseUrl;
});
},
View
9 test/unit/resources/th_main.js
@@ -21,7 +21,10 @@ var $log = require('rdcommon/log'),
$errbackoff = require('mailapi/errbackoff'),
$imapjs = require('imap'),
$smtpacct = require('mailapi/smtp/account'),
- $router = require('mailapi/worker-router');
+ $router = require('mailapi/worker-router'),
+
+ $th_fake_imap_server = require('tests/resources/th_fake_imap_server'),
+ $th_fake_as_server = require('tests/resources/th_fake_activesync_server');
function checkFlagDefault(flags, flag, def) {
if (!flags || !flags.hasOwnProperty(flag))
@@ -2447,6 +2450,10 @@ exports.TESTHELPER = {
// ActiveSync!
$activesyncacct.LOGFAB, $activesyncfolder.LOGFAB, $activesyncjobs.LOGFAB,
],
+ TESTHELPER_DEPS: [
+ $th_fake_as_server.TESTHELPER,
+ $th_fake_imap_server.TESTHELPER,
+ ],
actorMixins: {
testUniverse: TestUniverseMixins,
testAccount: TestCommonAccountMixins,
View
5 test/unit/test_activesync_general.js
@@ -5,18 +5,17 @@
**/
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'wbxml', 'activesync/codepages',
'exports'],
- function($tc, $th_imap, $th_as_server, $wbxml, $ascp, exports) {
+ function($tc, $th_main, $wbxml, $ascp, exports) {
// This is the number of messages after which the sync logic will
// declare victory and stop filling.
const INITIAL_FILL_SIZE = 15;
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_activesync_general' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('folder sync', function(T) {
const FilterType = $ascp.AirSync.Enums.FilterType;
View
5 test/unit/test_activesync_html.js
@@ -4,15 +4,14 @@
**/
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'./resources/messageGenerator',
'wbxml', 'activesync/codepages',
'exports'],
- function($tc, $th_imap, $th_as_server, $msggen, $wbxml, $ascp, exports) {
+ function($tc, $th_main, $msggen, $wbxml, $ascp, exports) {
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_activesync_html' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('folder sync', function(T) {
const FilterType = $ascp.AirSync.Enums.FilterType;
View
5 test/unit/test_activesync_recreate.js
@@ -4,14 +4,13 @@
**/
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'wbxml', 'activesync/codepages',
'exports'],
- function($tc, $th_imap, $th_as_server, $wbxml, $ascp, exports) {
+ function($tc, $th_main, $wbxml, $ascp, exports) {
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_activesync_recreate' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('create, recreate offline', function(T) {
const FilterType = $ascp.AirSync.Enums.FilterType;
View
5 test/unit/test_body_observers.js
@@ -1,12 +1,11 @@
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'activesync/codepages', 'exports'],
- function($tc, $th_imap, $th_as_server, $ascp, exports) {
+ function($tc, $th_main, $ascp, exports) {
var FilterType = $ascp.AirSync.Enums.FilterType;
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_body_observers' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('body update events', function(T, RT) {
var testUniverse = T.actor('testUniverse', 'U', { realDate: true }),
View
5 test/unit/test_folder_storage.js
@@ -14,14 +14,13 @@
**/
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'mailapi/date', 'mailapi/mailslice', 'mailapi/syncbase', 'exports'],
- function($tc, $th_imap, $th_as_server, $date, $mailslice, $syncbase,
+ function($tc, $th_main, $date, $mailslice, $syncbase,
exports) {
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_folder_storage' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
function MockDB() {
}
View
5 test/unit/test_just_auth.js
@@ -1,11 +1,10 @@
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'exports'],
- function($tc, $th_imap, $th_as_server, exports) {
+ function($tc, $th_main, exports) {
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_just_auth' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('just auth', function(T, RT) {
var TEST_PARAMS = RT.envOptions;
View
5 test/unit/test_mutation.js
@@ -29,14 +29,13 @@
**/
define(['rdcommon/testcontext', './resources/th_main',
- './resources/th_activesync_server',
'activesync/codepages/AirSync', 'exports'],
- function($tc, $th_imap, $th_as_server, $airsync, exports) {
+ function($tc, $th_main, $airsync, exports) {
const FilterType = $airsync.Enums.FilterType;
var TD = exports.TD = $tc.defineTestsFor(
{ id: 'test_mutation' }, null,
- [$th_imap.TESTHELPER, $th_as_server.TESTHELPER], ['app']);
+ [$th_main.TESTHELPER], ['app']);
TD.commonCase('deleting headers midflight', function(T, RT) {
T.group('setup');

0 comments on commit 65069bb

Please sign in to comment.
Something went wrong with that request. Please try again.