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.
authorjonathandicarlo@jonathan-dicarlos-macbook-pro.local
Tue, 06 May 2008 13:13:26 -0700
changeset 44440 0468527974dbf3a313812ab945de42f1a506c5b4
parent 44439 b949e9f6b2fc258aa42ca2e8a0bd46abb40c03ff
child 44441 3f84b87252ccff16953feb4051d051aaf4f3154c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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
new file mode 100644
--- /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();
+  };
+};