use the package_name info from mozversion to start fennec

This commit is contained in:
Julien Pagès 2015-02-12 21:21:05 +01:00
Родитель 46f9c30547
Коммит c0eb59cde5
2 изменённых файлов: 20 добавлений и 7 удалений

Просмотреть файл

@ -171,6 +171,7 @@ class B2GLauncher(MozRunnerLauncher):
class FennecLauncher(Launcher):
app_info = None
adb = None
package_name = None
@classmethod
def check_is_runnable(cls):
@ -189,17 +190,19 @@ class FennecLauncher(Launcher):
raise LauncherNotRunnable('Aborted.')
def _install(self, dest):
self.adb = ADBAndroid()
self.adb.uninstall_app("org.mozilla.fennec")
self.adb.install_app(dest)
# get info now, as dest may be removed
self.app_info = mozversion.get_version(binary=dest)
self.package_name = self.app_info.get("package_name",
"org.mozilla.fennec")
self.adb = ADBAndroid()
self.adb.uninstall_app(self.package_name)
self.adb.install_app(dest)
def _start(self, **kwargs):
self.adb.launch_fennec("org.mozilla.fennec")
self.adb.launch_fennec(self.package_name)
def _stop(self):
self.adb.stop_application("org.mozilla.fennec")
self.adb.stop_application(self.package_name)
def get_app_info(self):
return self.app_info

Просмотреть файл

@ -163,10 +163,10 @@ class TestFennecLauncher(unittest.TestCase):
@patch('mozregression.launchers.os.unlink')
@patch('mozregression.launchers.mozversion.get_version')
@patch('mozregression.launchers.ADBAndroid')
def create_launcher(self, ADBAndroid, get_version, *a):
def create_launcher(self, ADBAndroid, get_version, *a, **kwargs):
self.adb = Mock()
ADBAndroid.return_value = self.adb
get_version.return_value = 'version'
get_version.return_value = kwargs.get('version_value', {})
return launchers.FennecLauncher('http://binary')
def test_install(self):
@ -183,6 +183,16 @@ class TestFennecLauncher(unittest.TestCase):
launcher.stop()
self.adb.stop_application.assert_called_once_with("org.mozilla.fennec")
def test_adb_calls_with_custom_package_name(self):
pkg_name = 'org.mozilla.custom'
launcher = \
self.create_launcher(version_value={'package_name': pkg_name})
self.adb.uninstall_app.assert_called_once_with(pkg_name)
launcher.start()
self.adb.launch_fennec.assert_called_once_with(pkg_name)
launcher.stop()
self.adb.stop_application.assert_called_once_with(pkg_name)
@patch('mozregression.launchers.ADBHost')
@patch('__builtin__.raw_input')
def test_check_is_runnable(self, raw_input, ADBHost):