# session-terminate. node = jp.SetIq(jt.peer, jt.jid, [ jp.Jingle(jt.sid, jt.peer, 'content-remove', [ jp.Content(c['name'], c['creator'], c['senders']) ]) ]) stream.send(jp.xml(node)) else: # The Telepathy client removes the second stream; Gabble should # terminate the session rather than sending a content-remove. chan.StreamedMedia.RemoveStreams([stream2_id]) st, closed = q.expect_many( EventPattern('stream-iq', predicate=jp.action_predicate('session-terminate')), # Gabble shouldn't wait for the peer to ack the terminate before # considering the call finished. EventPattern('dbus-signal', signal='Closed', path=path)) # Only now does the peer ack the content-remove. This serves as a # regression test for contents outliving the session; if the content didn't # die properly, this crashed Gabble. stream.send(content_remove_ack) sync_stream(q, stream) # The peer can ack the terminate too, just for completeness. stream.send(make_result_iq(stream, st.stanza)) if __name__ == '__main__': test_dialects(gabble_terminates, [JingleProtocol015, JingleProtocol031]) test_dialects(peer_terminates, [JingleProtocol015, JingleProtocol031])
# accept with a subset of the codecs old_codecs = jt2.audio_codecs jt2.audio_codecs = jt2.audio_codecs[:-1] # all but the last one # session-accept jt2.accept() ret = q.expect('dbus-signal', signal='NewMediaDescriptionOffer') # make sure the codec offer has the updated codecs assertEquals(ret.args[1][cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"], md[cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"][:-1]) # accept new offer offer = bus.get_object(conn.bus_name, ret.args[0]) md[cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"].pop() offer.Accept(md, dbus_interface=cs.CALL_CONTENT_MEDIA_DESCRIPTION) # now we should both have the smaller set of codecs, easy o = q.expect ('dbus-signal', signal='RemoteMediaDescriptionsChanged') assertEquals (md[cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"], o.args[0][remote_handle][cs.CALL_CONTENT_MEDIA_DESCRIPTION + ".Codecs"]) chan.Close(dbus_interface=cs.CHANNEL) signal = q.expect('dbus-signal', signal='ChannelClosed') try_to_access_old_offer(conn, ret.args[0]) if __name__ == '__main__': test_dialects(test_incoming, [JingleProtocol031]) test_dialects(test_outgoing, [JingleProtocol031])
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)) # ...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]) # 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), ) if __name__ == "__main__": test_dialects(worker, [JingleProtocol015, JingleProtocol031])
# Gabble shouldn't wait for the peer to ack the terminate before # considering the call finished. EventPattern('dbus-signal', signal='CallStateChanged')) assertEquals(ended.args[0], cs.CALL_STATE_ENDED) # Only now does the peer ack the content-remove. This serves as a # regression test for contents outliving the session; if the content did # did't die properly, this crashed Gabble. self.stream.send(content_remove_ack) sync_stream(self.q, self.stream) # The peer can ack the terminate too, just for completeness. self.stream.send(make_result_iq(self.stream, st.stanza)) def hangup(self): pass if __name__ == '__main__': dialects = [JingleProtocol015, JingleProtocol031] test_dialects( partial(run_call_test, klass=CallContentAddingRemovalTest, incoming=False, params={'peer-removes-final-content': True}), dialects) test_dialects( partial(run_call_test, klass=CallContentAddingRemovalTest, incoming=False, params={'peer-removes-final-content': False}), dialects)
st, ended = self.q.expect_many( EventPattern('stream-iq', predicate=self.jp.action_predicate('session-terminate')), # Gabble shouldn't wait for the peer to ack the terminate before # considering the call finished. EventPattern('dbus-signal', signal='CallStateChanged')) assertEquals(ended.args[0], cs.CALL_STATE_ENDED) # Only now does the peer ack the content-remove. This serves as a # regression test for contents outliving the session; if the content did # did't die properly, this crashed Gabble. self.stream.send(content_remove_ack) sync_stream(self.q, self.stream) # The peer can ack the terminate too, just for completeness. self.stream.send(make_result_iq(self.stream, st.stanza)) def hangup(self): pass if __name__ == '__main__': dialects = [JingleProtocol015, JingleProtocol031] test_dialects( partial(run_call_test, klass=CallContentAddingRemovalTest, incoming=False, params={'peer-removes-final-content': True}), dialects) test_dialects( partial(run_call_test, klass=CallContentAddingRemovalTest, incoming=False, params={'peer-removes-final-content': False}), dialects)