on xenial help sign in
Use the greeter dbus method in process_helpers.unlock_unity
commit7ba2cb51a613590ecf81e77e79c3371dd64f175f authorMichał Sawicz <michal.sawicz@canonical.com> dateMon 8 Sep 2014, 11:28 (12 years ago) parent221e0d2
2 files changed+15−17
tests/autopilot/unity8/process_helpers.py+11−16 tests/autopilot/unity8/shell/emulators/greeter.py+4−1
tests/autopilot/unity8/process_helpers.py+11−16
@@ -20,6 +20,7 @@
2020import logging
2121import subprocess
2222import sys
23+import dbus
2324
2425# This has to work in both python 3 (ap 1.5) and py2 (ap legacy 1.4.1) so we
2526# pick the correct location in each case. Remove the py2 branch once we no
@@ -82,22 +83,16 @@ def unlock_unity(unity_proxy_obj=None):
8283 if greeter.created is False:
8384 raise RuntimeWarning("Greeter appears to be already unlocked.")
8485
85− # Because of potential input jerkiness under heavy load,
86− # retry unlocking the greeter two times.
87− # https://bugs.launchpad.net/ubuntu/+bug/1260113
88−
89− retries = 3
90− while retries > 0:
91− try:
92− greeter.swipe()
93− except AssertionError:
94− retries -= 1
95− if retries == 0:
96− raise
97− logger.info("Failed to unlock greeter, trying again...")
98− else:
99− logger.info("Greeter unlocked, continuing.")
100− break
86+ bus = dbus.SessionBus()
87+ dbus_proxy = bus.get_object("com.canonical.UnityGreeter", "/")
88+ try:
89+ dbus_proxy.HideGreeter()
90+ except dbus.DBusException:
91+ logger.info("Failed to unlock greeter")
92+ raise
93+ else:
94+ greeter.wait_unlocked()
95+ logger.info("Greeter unlocked, continuing.")
10196
10297
10398def lock_unity(unity_proxy_obj=None):
tests/autopilot/unity8/shell/emulators/greeter.py+4−1
@@ -25,6 +25,9 @@ from unity8.shell.emulators import UnityEmulatorBase
2525class Greeter(UnityEmulatorBase):
2626 """An emulator that understands the greeter screen."""
2727
28+ def wait_unlocked(self):
29+ self.showProgress.wait_for(0)
30+
2831 def swipe(self):
2932 """Swipe the greeter screen away."""
3033 self.created.wait_for(True)
@@ -37,7 +40,7 @@ class Greeter(UnityEmulatorBase):
3740 stop_y = start_y
3841 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
3942
40− self.showProgress.wait_for(0)
43+ self.wait_unlocked()
4144
4245 def get_prompt(self):
4346 return self.select_single(