[Telepathy-commits] [telepathy-gabble/master] Add a test for StreamHandler::Error crashing Gabble

Will Thompson will.thompson at collabora.co.uk
Thu Feb 19 02:37:30 PST 2009


---
 tests/twisted/Makefile.am                    |    1 +
 tests/twisted/jingle/stream-handler-error.py |   55 ++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/jingle/stream-handler-error.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 5a2d1f0..e36dc2c 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -75,6 +75,7 @@ TWISTED_TESTS = \
 	jingle/hold-audio.py \
 	jingle/hold-av.py \
 	jingle/payload-types.py \
+	jingle/stream-handler-error.py \
 	jingle/test-content-adding-removal.py \
 	jingle/test-incoming-call.py \
 	jingle/test-incoming-call-reject.py \
diff --git a/tests/twisted/jingle/stream-handler-error.py b/tests/twisted/jingle/stream-handler-error.py
new file mode 100644
index 0000000..6712da7
--- /dev/null
+++ b/tests/twisted/jingle/stream-handler-error.py
@@ -0,0 +1,55 @@
+"""
+Test handling of errors from StreamHandler during calls. This is a regression
+test for a bug introduced by 54021cee0ad38 which removed an idle callback
+masking refcounting assumptions.
+"""
+
+from gabbletest import exec_test
+from servicetest import make_channel_proxy, tp_path_prefix, EventPattern
+import jingletest
+
+
+def test(q, bus, conn, stream):
+    jt = jingletest.JingleTest(stream, 'test at localhost', 'foo at bar.com/Foo')
+
+    conn.Connect()
+
+    q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+    remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+
+    # Remote end calls us
+    jt.incoming_call()
+
+    # The caller is in members
+    e = q.expect('dbus-signal', signal='MembersChanged',
+             args=[u'', [remote_handle], [], [], [], 0, 0])
+
+    # We're pending because of remote_handle
+    e = q.expect('dbus-signal', signal='MembersChanged',
+             args=[u'', [], [], [1L], [], remote_handle, 0])
+
+    media_chan_suffix = e.path
+
+    # S-E gets notified about new session handler, and calls Ready on it
+    e = q.expect('dbus-signal', signal='NewSessionHandler')
+    session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
+    session_handler.Ready()
+
+    e = q.expect('dbus-signal', signal='NewStreamHandler')
+
+    # S-E gets notified about a newly-created stream
+    stream_handler = make_channel_proxy(conn, e.args[0], 'Media.StreamHandler')
+
+    # Something goes wrong immediately!
+    stream_handler.Error(0, "i'll have the eggs tostada please")
+
+    # Gabble doesn't fall over, and the channel closes nicely.
+    e = q.expect('dbus-signal', signal='Closed', path=media_chan_suffix)
+
+    conn.Disconnect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+if __name__ == '__main__':
+    exec_test(test)
+
-- 
1.5.6.5




More information about the telepathy-commits mailing list