From 14e111cff49aa5836e5a0a347046cd6baece428b Mon Sep 17 00:00:00 2001 From: "jonathandicarlo@jonathan-dicarlos-macbook-pro.local" Date: Tue, 6 May 2008 13:13:26 -0700 Subject: [PATCH] Made a very simple unit test for xmppClient; it's passing, but currently it connects to the hard-coded URL of a jabber server running on localhost; I'll need to change this if other people are going to be able to run this test. --- services/sync/tests/unit/test_xmpp.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 services/sync/tests/unit/test_xmpp.js diff --git a/services/sync/tests/unit/test_xmpp.js b/services/sync/tests/unit/test_xmpp.js new file mode 100644 index 00000000000..956e1195d62 --- /dev/null +++ b/services/sync/tests/unit/test_xmpp.js @@ -0,0 +1,25 @@ +var Cu = Components.utils; + +Cu.import( "resource://weave/xmpp/xmppClient.js" ); + +var serverUrl = "http://127.0.0.1:5280/http-poll"; +var jabberName = "alice"; +var jabberDomain = "jonathan-dicarlos-macbook-pro.local"; +var jabberPassword = "iamalice"; + +function run_test() { + /* First, just see if we can connect: */ + var transport = new HTTPPollingTransport( serverUrl, + false, + 10000 ); + var auth = new PlainAuthenticator(); + var client = new XmppClient( jabberName, jabberDomain, jabberPassword, + transport, auth ); + + client.connect( jabberDomain ); + client.waitForConnection(); + do_check_neq( client._connectionStatus, client.FAILED ); + if ( client._connectionStatus != client.FAILED ) { + client.disconnect(); + }; +};