[telepathy-gabble/master] Meaningfully test a content-remove collision.

Will Thompson will.thompson at collabora.co.uk
Wed Apr 29 09:57:03 PDT 2009


The comment on the previous incarnation is wrong. Gabble *shouldn't*
ignore the incoming content-remove and send its own. But since it hasn't
received it when RemoveStreams is called, it will send its own.
---
 tests/twisted/jingle/test-content-complex.py |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tests/twisted/jingle/test-content-complex.py b/tests/twisted/jingle/test-content-complex.py
index f2b3f91..e1e8053 100644
--- a/tests/twisted/jingle/test-content-complex.py
+++ b/tests/twisted/jingle/test-content-complex.py
@@ -2,6 +2,7 @@
 Test everything related to contents
 """
 
+from gabbletest import sync_stream
 from servicetest import make_channel_proxy, tp_path_prefix
 import constants as cs
 from jingletest2 import (
@@ -183,26 +184,28 @@ def worker(jp, q, bus, conn, stream):
     # We get remote codecs
     e = q.expect('dbus-signal', signal='SetRemoteCodecs')
 
-    # Now, both we and remote peer try to remove the content simultaneously
+    # Now, both we and remote peer try to remove the content simultaneously:
+    # Telepathy client calls RemoveStreams...
     media_iface.RemoveStreams([id3])
+
+    # ...so Gabble sends a content-remove...
+    e = q.expect('stream-iq', iq_type='set', predicate=lambda x:
+        xpath.queryForNodes("/iq/jingle[@action='content-remove']",
+            x.stanza))
+
+    # ...but before it's acked the peer sends its own content-remove...
     node = jp.SetIq(jt2.peer, jt2.jid, [
         jp.Jingle(jt2.sid, jt2.peer, 'content-remove', [
             jp.Content(c['name'], c['creator'], c['senders'], []) ]) ])
     stream.send(jp.xml(node))
 
-    # Gabble should ignore our content-remove and send it's own
-    # (fixme: this could be racy)
-    e = q.expect('stream-iq', iq_type='set', predicate=lambda x:
-        xpath.queryForNodes("/iq/jingle[@action='content-remove']",
-            x.stanza))
+    # ...and we don't want Gabble to break when that happens.
+    sync_stream(q, stream)
 
     # Now we want to remove the first stream
     media_iface.RemoveStreams([id1])
 
-    # The remote peer still hasn't ackd the first stream removal, but since
-    # gabble knows no streams will be left after the removal completes,
-    # it will just terminate the session.
-
+    # Since this is the last stream, Gabble will just terminate the session.
     e = q.expect('stream-iq', iq_type='set', predicate=lambda x:
         xpath.queryForNodes("/iq/jingle[@action='session-terminate']",
             x.stanza))
-- 
1.5.6.5




More information about the telepathy-commits mailing list