~ubuntu-branches/ubuntu/oneiric/weave/oneiric

« back to all changes in this revision

Viewing changes to tests/system/bobjabber.js

  • Committer: Bazaar Package Importer
  • Author(s): Micah Gersten
  • Date: 2010-08-11 00:35:15 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100811003515-o3jbh826bnd1syjv
Tags: 1.4.3-1ubuntu1
* Add -fshort-wchar to CXXFLAGS to fix FTBFS in Ubuntu
  - update debian/rules 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var Cc = Components.classes;
2
 
var Ci = Components.interfaces;
3
 
var Cu = Components.utils;
4
 
 
5
 
Cu.import("resource://weave/xmpp/xmppClient.js");
6
 
 
7
 
var transport = new HTTPPollingTransport( "http://127.0.0.1:5280/http-poll",
8
 
                                          false,
9
 
                                          10000 );
10
 
 
11
 
var auth = new PlainAuthenticator();
12
 
var client = new JabberClient("bob",
13
 
                              "jonathan-dicarlos-macbook-pro.local",
14
 
                              "iambob",
15
 
                              transport,
16
 
                              auth );
17
 
 
18
 
var testSync = new TestSynchronizer( client, 
19
 
                                     "alice@jonathan-dicarlos-macbook-pro.local" );
20
 
client.registerMessageHandler( testSync );
21
 
 
22
 
// Note: for ejabberd, the correct string to use for "host" here, when
23
 
// connecting, is what's specified on the {hosts, ... line of ejabberd.cfg.
24
 
client.connect( "jonathan-dicarlos-macbook-pro.local" );  // jabber host
25
 
 
26
 
client.waitForConnection();
27
 
if ( client._connectionStatus == client.FAILED ) {
28
 
  dump( "Connection attempt failed.  Boo hoo!\n" );
29
 
 } else {
30
 
  client.announcePresence();
31
 
  testSync.waitForPartnerOnline();
32
 
 
33
 
  client.sendMessage( "alice@jonathan-dicarlos-macbook-pro.local", "Hello from Bob"  );
34
 
 
35
 
  for ( var x = 0; x < 10; x++ ) {
36
 
    dump( "Bob doing part " + x + " of the test.\n" );
37
 
    dump( "Bob entering barrier " + x + ".\n" );
38
 
    testSync.barrier( x );
39
 
    dump( "Bob past barrier " + x + ".\n" );
40
 
    }
41
 
 
42
 
  client.waitForDisconnect();
43
 
 }
44
 
 
45
 
 
46
 
 
47
 
  /*  var value = client.iqSet( "alice@jonathan-dicarlos-macbook-pro.local",
48
 
                            "Nonihilf", "Rocinante" );
49
 
                            dump( "Alice told me that the value of nonihilf is " + value + "\n" ); */