Merge lp:~alextu/savilerow/test_custom_sound into lp:savilerow

Proposed by Alex Tu
Status: Rejected
Rejected by: Kyle Nitzsche
Proposed branch: lp:~alextu/savilerow/test_custom_sound
Merge into: lp:savilerow
Diff against target: 70 lines (+66/-0)
1 file modified
tests/api/test_custom_sound.py (+66/-0)
To merge this branch: bzr merge lp:~alextu/savilerow/test_custom_sound
Reviewer Review Type Date Requested Status
Chris Wayne (community) Approve
Alex Chiang Pending
Ethan Chang Pending
Review via email: mp+230947@code.launchpad.net

Description of the change

Branched from lp:~ethan.chang/savilerow/test_custom_sound and modified the latest test case to check the synchronization between dconf and AccountsService by D-Bus interface.

Already got ethan's approval, so would like to merge back from this branch instead.

Thanks.

To post a comment you must log in.
16. By Alex Tu

revised typo.

Revision history for this message
Chris Wayne (cwayne) wrote :

This is still just testing that the dconf key is set though, just in a different way. WHat we need to do is query accounts service via dbus, which is how the dialer app itself gets the file to play. From the asana card:

The ringtone/SMS sounds can be found with a dbus call to com.ubuntu.touch.AccountsService.Sound (defined in /usr/share/dbus-1/interfaces/com.ubuntu.touch.AccountsService.Sound.xml)

review: Needs Fixing
Revision history for this message
Chris Wayne (cwayne) wrote :

Im sorry! I stopped reading after I saw dconf, then went back and realized you do check the accounts service! Can you verify that this was tested on a device?

Revision history for this message
Alex Tu (alextu) wrote :

> Im sorry! I stopped reading after I saw dconf, then went back and realized
> you do check the accounts service! Can you verify that this was tested on a
> device?

It related to the issue: LP#1358080.
I verified it, this test script could read out the value by dbus call and dconf then compare them.

But the truth is current Dbus call always return "/usr/share/sounds/ubuntu/ringtones/Ubuntu.ogg" even dconf has been set to other audio file by custom.key.

This ring tone not working issue is out of the test script's control. :)

Revision history for this message
Chris Wayne (cwayne) wrote :

OK then, LGTM!

review: Approve
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

too old, closing.

Unmerged revisions

16. By Alex Tu

revised typo.

15. By Alex Tu

remove debug message

14. By Alex Tu

Add a test to check if the value of 'IncomingCallSound' and 'IncomingMessageSound' from DBus was synced with 'incoming-call-sound' and 'incoming-message-sound' from dconf.

Refer to https://app.asana.com/0/11854387211831/14240643122533/f

13. By Ethan Chang

*Create a test_custom_sound.py to verify ringtone and notification sound

12. By Alex Tu

Add a new custom feature: let user customize pin 6 apps on Apps scope. And also add test case in test_dconf.py

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/api/test_custom_sound.py'
2--- tests/api/test_custom_sound.py 1970-01-01 00:00:00 +0000
3+++ tests/api/test_custom_sound.py 2014-08-15 15:04:12 +0000
4@@ -0,0 +1,66 @@
5+from autopilot.testcase import AutopilotTestCase
6+import os
7+import dbus
8+from gi.repository import Gio
9+
10+#: Custom Ringtones/Notifications
11+ringtone = "ring.mp3"
12+notification = "sms.mp3"
13+
14+#: Ringtone/Notifications installation directory
15+ringtones_path = "/custom/usr/share/sounds/ubuntu/stereo/"
16+notifications_path = "/custom/usr/share/sounds/ubuntu/stereo/"
17+
18+class SoundsVerificationTest(AutopilotTestCase):
19+ """
20+ Downstream may ship pre-installed customized ringtone and notification
21+ sound as part of the custom tarball. If so, they will be unpacked and
22+ installed into /usr/share/sounds/
23+
24+ These tests verify that pre-installed ringtone and notification sounds
25+ are properly installed
26+ """
27+
28+ def test_ringtones_customization_directory_exists(self):
29+ """
30+ Verify existence of target directories for pre-installed sounds.
31+ """
32+ #for ringtone in ringtones:
33+ self.assertTrue(os.path.isfile(os.path.join(ringtones_path, ringtone)))
34+
35+ def test_notifications_customization_directory_exists(self):
36+ """
37+ Verify existence of target directories for pre-installed sounds.
38+ """
39+ #for notification in notifications:
40+ self.assertTrue(os.path.isfile(os.path.join(notifications_path, notification)))
41+
42+ def test_custom_sounds_running(self):
43+ """
44+ This test ensures that the custom ringtone and notification which set in dconf database
45+ have been synced picked by AccountsService dbus object.
46+ """
47+ settings = Gio.Settings('com.ubuntu.touch.sound')
48+ dconf_ringtone = settings.get_string('incoming-call-sound')
49+ dconf_notification = settings.get_string('incoming-message-sound')
50+
51+ # get the setting in dbus object.
52+ system_bus = dbus.SystemBus()
53+ manager_proxy = system_bus.get_object('org.freedesktop.Accounts',
54+ '/org/freedesktop/Accounts')
55+ object_path = manager_proxy.FindUserById(
56+ os.getuid(), dbus_interface='org.freedesktop.Accounts'
57+ )
58+ user_proxy = system_bus.get_object('org.freedesktop.Accounts', object_path)
59+
60+ try:
61+ ringtone = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingCallSound',
62+ dbus_interface=dbus.PROPERTIES_IFACE)
63+ notification = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingMessageSound',
64+ dbus_interface=dbus.PROPERTIES_IFACE)
65+
66+ except dbus.exceptions.DBusException as e:
67+ print("Couldn't get %s: %s" % (setting, e), file=sys.stderr)
68+
69+ self.assertTrue((ringtone in dconf_ringtone and notification in dconf_notification), "value does not sync between dconf and the one from DBus")
70+

Subscribers

People subscribed via source and target branches

to all changes: