summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-08-24 15:22:53 +0300
committerMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-08-24 15:23:57 +0300
commit70c4e20de8502ff86105acacdc3928645ffe4f62 (patch)
treece52c2074fabe2990a5e52af945ba7dda0956c46
parent3f3a3dfd968749732ac8f15f575467c15686e9ef (diff)
Factored the MediaSignalling audio session mockup into a voip_test utility
-rw-r--r--tests/twisted/voip/outgoing-basics.py19
-rw-r--r--tests/twisted/voip/voip_test.py30
2 files changed, 31 insertions, 18 deletions
diff --git a/tests/twisted/voip/outgoing-basics.py b/tests/twisted/voip/outgoing-basics.py
index 057b8ca..42118cd 100644
--- a/tests/twisted/voip/outgoing-basics.py
+++ b/tests/twisted/voip/outgoing-basics.py
@@ -7,8 +7,7 @@ import dbus
from sofiatest import exec_test
from servicetest import (
- make_channel_proxy, wrap_channel,
- EventPattern, call_async,
+ wrap_channel, EventPattern, call_async,
assertEquals, assertContains, assertLength, assertSameSets
)
import constants as cs
@@ -175,22 +174,8 @@ def worker(q, bus, conn, sip_proxy, variant, peer):
cs.MEDIA_STREAM_PENDING_REMOTE_SEND),
streams[0][1:])
- # S-E does state recovery to get the session handler, and calls Ready on it
- session_handlers = chan.MediaSignalling.GetSessionHandlers()
- sh_path, sh_type = session_handlers[0]
+ stream_handler = context.handle_audio_session(chan)
- assert sh_type == 'rtp'
-
- session_handler = make_channel_proxy(conn, sh_path, 'Media.SessionHandler')
- session_handler.Ready()
-
- e = q.expect('dbus-signal', signal='NewStreamHandler')
-
- stream_handler = make_channel_proxy(conn, e.args[0], 'Media.StreamHandler')
-
- stream_handler.NewNativeCandidate("fake", context.get_remote_transports_dbus())
- stream_handler.NativeCandidatesPrepared()
- stream_handler.Ready(context.get_audio_codecs_dbus())
stream_handler.StreamState(cs.MEDIA_STREAM_STATE_CONNECTED)
sh_props = stream_handler.GetAll(
diff --git a/tests/twisted/voip/voip_test.py b/tests/twisted/voip/voip_test.py
index b31928f..c8724af 100644
--- a/tests/twisted/voip/voip_test.py
+++ b/tests/twisted/voip/voip_test.py
@@ -4,7 +4,10 @@ import uuid
import twisted.protocols.sip
-from servicetest import assertContains
+from servicetest import (
+ make_channel_proxy,
+ assertContains,
+ )
class VoipTestContext(object):
# Default audio codecs for the remote end
@@ -178,3 +181,28 @@ class VoipTestContext(object):
def terminate(self):
return self.send_message('BYE', call_id=self.call_id)
+
+ def handle_audio_session(self, chan):
+ """
+ Serves a SessionHandler and a StreamHandler for the MediaSignalling
+ channel. Returns the interface proxy for StreamHandler.
+ """
+ session_handlers = chan.MediaSignalling.GetSessionHandlers()
+ sh_path, sh_type = session_handlers[0]
+
+ assert sh_type == 'rtp'
+
+ session_handler = make_channel_proxy(self.conn, sh_path,
+ 'Media.SessionHandler')
+ session_handler.Ready()
+
+ e = self.q.expect('dbus-signal', signal='NewStreamHandler')
+
+ stream_handler = make_channel_proxy(self.conn, e.args[0],
+ 'Media.StreamHandler')
+
+ stream_handler.NewNativeCandidate("fake", self.get_remote_transports_dbus())
+ stream_handler.NativeCandidatesPrepared()
+ stream_handler.Ready(self.get_audio_codecs_dbus())
+
+ return stream_handler