diff options
author | Giovanni Campagna <gcampagna@src.gnome.org> | 2013-08-18 22:57:30 +0200 |
---|---|---|
committer | Giovanni Campagna <gcampagna@src.gnome.org> | 2013-08-19 09:53:05 +0200 |
commit | 0eb96d7a20607e66450cde3d7864393f06cb9e34 (patch) | |
tree | 18bae24fc764c1d0c877a25809eac9f0d6513b68 /tests | |
parent | 2f78a825a3283d23dd5b726d9553d8f058825267 (diff) | |
download | gnome-settings-daemon-0eb96d7a20607e66450cde3d7864393f06cb9e34.tar.gz |
power: restore the ability of running the test suite
We need to provide a mock mutter in the test environment.
Also, we need to make sure a few objects exist right away, as
the mock environment starts dbus calls before we're really
initialized.
https://bugzilla.gnome.org/show_bug.cgi?id=705507
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gsdtestcase.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/gsdtestcase.py b/tests/gsdtestcase.py index 2f8d1de4..c2ec2957 100644 --- a/tests/gsdtestcase.py +++ b/tests/gsdtestcase.py @@ -185,6 +185,47 @@ class GSDTestCase(dbusmock.DBusTestCase): self.logind.terminate() self.logind.wait() + def start_mutter(self): + ''' start mock mutter DisplayConfig ''' + self.mutter = self.spawn_server('org.gnome.Mutter.DisplayConfig', + '/org/gnome/Mutter/DisplayConfig', + 'org.gnome.Mutter.DisplayConfig', + stdout=subprocess.PIPE) + self.obj_mutter = self.session_bus_con.get_object( + 'org.gnome.Mutter.DisplayConfig', '/org/gnome/Mutter/DisplayConfig') + + self.obj_mutter.AddMethods('', + [ + ('GetResources', '', 'ua(uxiiiiiuaua{sv})a(uxiausauaua{sv})a(uxuud)ii', ''' +ret = (1, [(0, 1, 0, 0, 1024, 768, 0, 0, [0, 1, 2, 3, 4, 5, 6, 7], {}), + (1, 2, 0, 0, 0, 0, -1, 0, [], {})], + [(0, 3, 0, [0, 1], 'LVDS1', [0, 1], [], {'vendor': 'FOO', + 'product': '0x0000', + 'serial': '0x0000000', + 'display-name': 'Built-in Display', + 'backlight': -1, + 'primary': True })], + [(0, 5, 1024, 768, 60), (1, 6, 800, 600, 60)], 8192, 8192)'''), + ('ApplyConfiguration', 'uba(uiiiuaua{sv})a(ua{sv})', '', ''), + ('ChangeBacklight', 'uui', '', ''), + ('GetCrtcGamma', 'uu', 'aqaqaq', 'ret = ([],[],[])'), + ('SetCrtcGamma', 'uuaqaqaq', '', ''), + ], dbus_interface='org.freedesktop.DBus.Mock') + + self.obj_mutter.AddProperties('', + { + 'PowerSaveMode': 0, + }) + + # set log to nonblocking + set_nonblock(self.mutter.stdout) + + def stop_mutter(self): + '''stop mock mutter''' + + self.mutter.terminate() + self.mutter.wait() + @classmethod def start_xorg(klass): '''start X.org server with dummy driver''' |