[telepathy-gabble/master] Call remote-candidates with the stream it should apply to

Sjoerd Simons sjoerd.simons at collabora.co.uk
Wed Dec 23 05:10:06 PST 2009


This allows us to send the transport info per stream we have and makes it send
the right transport-info stanza. Also tweak the GTalk Content and Jingle
function so it understands cases without a description correctly
---
 tests/twisted/jingle/call-basics.py |    2 +-
 tests/twisted/jingle/jingletest2.py |   25 ++++++++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/tests/twisted/jingle/call-basics.py b/tests/twisted/jingle/call-basics.py
index 7956761..dfb3ce5 100644
--- a/tests/twisted/jingle/call-basics.py
+++ b/tests/twisted/jingle/call-basics.py
@@ -252,7 +252,7 @@ def run_test(jp, q, bus, conn, stream, incoming):
     assertEquals (cs.MEDIA_STREAM_STATE_DISCONNECTED, state)
 
     if incoming or jp.dialect != 'gtalk-v0.4':
-        jt2.remote_candidates()
+        jt2.remote_candidates(jt2.audio_names[0], "initiator")
 
         remote_candidates = q.expect ('dbus-signal',
             signal='RemoteCandidatesAdded', interface=cs.CALL_STREAM_ENDPOINT)
diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index 8e69591..3c7a7f8 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -236,18 +236,20 @@ class GtalkProtocol03(JingleProtocol):
 
         return p
 
-    # Gtalk has only one content, and <content> node is implicit
+    # Gtalk has only one content, and <content> node is implicit. Also it
+    # never mixes payloads and transport information. It's up to the call of
+    # this function to ensure it nevel calls it with both mixed
     def Content(self, name, creator, senders=None,
             description=None, transport=None):
         # Normally <content> has <description> and <transport>, but we only
         # use <description> unless <transport> has candidates.
-        assert description != None
-        assert transport != None
+        assert description == None or len(transport[3]) == 0
 
         # if <transport> has children return those children (candidates)
-        if len(transport[3]) > 0:
+        if description != None:
+            return description
+        else:
             return transport[3][0]
-        return description
 
     def Description(self, type, children):
         if type == 'audio':
@@ -319,7 +321,9 @@ class GtalkProtocol04(JingleProtocol):
     def Jingle(self, sid, initiator, action, children):
         # ignore Content and go straight for its children
         if len(children) == 1 and children[0][0] == 'dummy-content':
-            children = [ children[0][3][0], children[0][3][1] ]
+            # Either have just a transport or a description + transport
+            # without candidates
+            children = children[0][3]
 
         action = self._action_map(action)
         return ('session', ns.GOOGLE_SESSION,
@@ -666,12 +670,15 @@ class JingleTest2:
             jp.Jingle(self.sid, self.peer, 'session-terminate', body) ])
         self.stream.send(jp.xml(iq))
 
-    def remote_candidates(self):
+    def remote_candidates(self, name, creator):
         jp = self.jp
 
-        contents = self.generate_contents(transports=self.remote_transports)
         node = jp.SetIq(self.peer, self.jid,
-            [ jp.Jingle(self.sid, self.peer, 'transport-info', contents) ])
+            [ jp.Jingle(self.sid, self.peer, 'transport-info',
+                [ jp.Content(name, creator,
+                    transport=jp.TransportGoogleP2P (self.remote_transports))
+                ] )
+            ])
         self.stream.send(jp.xml(node))
 
     def dbusify_codecs(self, codecs):
-- 
1.5.6.5




More information about the telepathy-commits mailing list