summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhilippe Nunes <philippe.nunes@linux.intel.com>2012-09-06 16:38:46 +0200
committerDenis Kenzior <denkenz@gmail.com>2012-09-11 23:27:14 -0500
commite0e037539a72c6b6b03b8e1ffdbe5eb70b3a813d (patch)
tree93fc1df80d11b47a5c86b54981a00677ad6c99ce /test
parent5fa986eaab0016eec70b1d2805a7b940a7e8dda8 (diff)
downloadofono-e0e037539a72c6b6b03b8e1ffdbe5eb70b3a813d.tar.bz2
test: playtone waits for single tone playback
To simulate the single tone playback (avoiding the stkagent method to return immediately), a timeout is started (5 seconds). During this time, the user can terminate the session.
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-stk-menu18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test-stk-menu b/test/test-stk-menu
index 6e7f7b78..f4553d12 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -6,6 +6,10 @@ import sys
import dbus
import dbus.service
import dbus.mainloop.glib
+import signal
+
+def handler(signum, frame):
+ raise Exception("\nSingle tone is finished!")
class GoBack(dbus.DBusException):
_dbus_error_name = "org.ofono.Error.GoBack"
@@ -195,6 +199,20 @@ class StkAgent(dbus.service.Object):
print "Text: %s" % (text)
print "Icon: %d" % (icon)
+ signal.signal(signal.SIGALRM, handler)
+ signal.alarm(5)
+
+ try:
+ key = raw_input("Press return to end before end of"
+ " single tone (t):")
+ signal.alarm(0)
+
+ if key == 't':
+ raise EndSession("User wishes to terminate"
+ " session");
+ except Exception, exc:
+ print exc
+
@dbus.service.method("org.ofono.SimToolkitAgent",
in_signature="ssy", out_signature="")
def LoopTone(self, tone, text, icon):