Add a testing method to open a activity with a uri

This can be used in the test to check if the activity can manage
different file formats.
This commit is contained in:
Gonzalo Odiard 2014-07-28 13:16:44 -03:00 committed by Martin Abente Lahaye
parent f48c3247f6
commit 952b8275a1

View File

@ -63,9 +63,19 @@ class UITestCase(unittest.TestCase):
process.terminate()
@contextmanager
def run_activity(self):
def run_activity(self, options=None):
self._run_activity(options)
@contextmanager
def run_activity_with_uri(self, uri):
self._run_activity(['--uri', uri])
def _run_activity(self, options=None):
if self.bundle_id is not None:
process = subprocess.Popen(["sugar-launch", self.bundle_id])
cmd = ["sugar-launch", self.bundle_id]
if options is not None:
cmd += options
process = subprocess.Popen(cmd)
else:
print "No bundle_id specified."
return