@@ -121,17 +121,14 @@ class UnityTestCase(AutopilotTestCase):
121 self._qml_mock_enabled = True
121 self._qml_mock_enabled = True
123 #### This is a work around re: lp:1238417 ####
123 #### This is a work around re: lp:1238417 ####
124+ if model() != "Desktop":
124− from autopilot.input import _uinput
125+ from autopilot.input import _uinput
125− _uinput._touch_device = _uinput.create_touch_device()
126+ _uinput._touch_device = _uinput.create_touch_device()
128 self.touch = Touch.create()
129 self.touch = Touch.create()
129 self._setup_display_details()
130 self._setup_display_details()
131− self._using_upstart = False
132− if model() != "Desktop": # or check env
133− self._using_upstart = True
135 def _reset_launcher(self):
132 def _reset_launcher(self):
136 """Reset Unity launcher hide mode"""
133 """Reset Unity launcher hide mode"""
137 self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
134 self._unityshell_schema.set_int(UNITYSHELL_LAUNCHER_KEY, self._launcher_hide_mode)
@@ -194,24 +191,22 @@ class UnityTestCase(AutopilotTestCase):
194 environments.
191 environments.
197− if self._using_upstart:
199− current_value = subprocess.check_output([
195+ current_value = subprocess.check_output([
204− except subprocess.CalledProcessError:
205− current_value = None
208 "/sbin/initctl",
196 "/sbin/initctl",
200+ except subprocess.CalledProcessError:
201+ current_value = None
209− "set-env",
205+ "set-env",
210− "%s=%s" % (key, value)
207+ "%s=%s" % (key, value)
212− self.addCleanup(self._upstart_reset_env, key, current_value)
209+ self.addCleanup(self._upstart_reset_env, key, current_value)
214− self.patch_environment(key, value)
216 def _upstart_reset_env(self, key, value):
211 def _upstart_reset_env(self, key, value):
217 logger.info("Resetting upstart env %s to %s", key, value)
212 logger.info("Resetting upstart env %s to %s", key, value)
@@ -252,16 +247,10 @@ class UnityTestCase(AutopilotTestCase):
252 except OSError:
247 except OSError:
255− if self._using_upstart:
256− app_proxy = self._launch_unity_with_upstart()
250+ app_proxy = self._launch_unity_with_upstart(
258− app_proxy = self.launch_test_application(
259− binary_path,
251+ binary_path,
260− *self.unity_geometry_args,
252+ self.unity_geometry_args
262− emulator_base=UnityEmulatorBase,
266 self._set_proxy(app_proxy)
255 self._set_proxy(app_proxy)
@@ -272,11 +261,24 @@ class UnityTestCase(AutopilotTestCase):
273 return app_proxy
262 return app_proxy
275− def _launch_unity_with_upstart(self):
264+ def _launch_unity_with_upstart(self, binary_path, args):
269+ "QT_LOAD_TESTABILITY=1"
277− subprocess.call(["/sbin/initctl", "set-env", "QT_LOAD_TESTABILITY=1"])
272+ binary_arg = "BINARY=%s" % binary_path
273+ extra_args = "ARGS=%s" % " ".join(args)
279− output = subprocess.check_output(["/sbin/initctl", "start", "unity8"])
275+ output = subprocess.check_output([
281 self.addCleanup(self._cleanup_launching_upstart_unity)
283 self.addCleanup(self._cleanup_launching_upstart_unity)