コード例 #1
0
ファイル: util_unittest.py プロジェクト: zloop1982/catapult
 def testLocallyBuiltPaths(self):
     self.assertEqual(
         util.GetBuildDirFromHostApkPath('/out/Foo/apks/test.apk'),
         '/out/Foo')
     self.assertEqual(
         util.GetBuildDirFromHostApkPath('/out/Bar/bin/test_bundle'),
         '/out/Bar')
コード例 #2
0
    def __init__(self,
                 browser_type,
                 finder_options,
                 android_platform,
                 backend_settings,
                 local_apk=None,
                 target_os='android'):
        super(PossibleAndroidBrowser,
              self).__init__(browser_type, target_os,
                             backend_settings.supports_tab_control)
        assert browser_type in FindAllBrowserTypes(), (
            'Please add %s to android_browser_finder.FindAllBrowserTypes' %
            browser_type)
        self._platform = android_platform
        self._platform_backend = (android_platform._platform_backend)  # pylint: disable=protected-access
        self._backend_settings = backend_settings
        self._local_apk = local_apk
        self._flag_changer = None
        self._modules_to_install = None
        self._compile_apk = finder_options.compile_apk

        if self._local_apk is None and finder_options.chrome_root is not None:
            self._local_apk = self._backend_settings.FindLocalApk(
                self._platform_backend.device, finder_options.chrome_root)

        # At this point the local_apk, if any, must exist.
        assert self._local_apk is None or os.path.exists(self._local_apk)
        self._build_dir = util.GetBuildDirFromHostApkPath(self._local_apk)

        if finder_options.modules_to_install:
            self._modules_to_install = set(['base'] +
                                           finder_options.modules_to_install)

        self._support_apk_list = []
        if (self._backend_settings.requires_embedder
                or self._backend_settings.has_additional_apk):
            if finder_options.webview_embedder_apk:
                self._support_apk_list = finder_options.webview_embedder_apk
            else:
                self._support_apk_list = self._backend_settings.FindSupportApks(
                    self._local_apk, finder_options.chrome_root)
        elif finder_options.webview_embedder_apk:
            logging.warning(
                'No embedder needed for %s, ignoring --webview-embedder-apk option',
                self._backend_settings.browser_type)

        # At this point the apks in _support_apk_list, if any, must exist.
        for apk in self._support_apk_list:
            assert os.path.exists(apk)
コード例 #3
0
 def _GetBrowserInstance(self, existing):
     browser_backend = android_browser_backend.AndroidBrowserBackend(
         self._platform_backend,
         self._browser_options,
         self.browser_directory,
         self.profile_directory,
         self._backend_settings,
         build_dir=util.GetBuildDirFromHostApkPath(self._local_apk))
     try:
         return browser.Browser(browser_backend,
                                self._platform_backend,
                                startup_args=(),
                                find_existing=existing)
     except Exception:
         browser_backend.Close()
         raise
コード例 #4
0
ファイル: util_unittest.py プロジェクト: zloop1982/catapult
 def testNonLocallyBuiltPath(self):
     self.assertEqual(
         util.GetBuildDirFromHostApkPath('/some/other/path/test.apk'), None)
コード例 #5
0
ファイル: util_unittest.py プロジェクト: zloop1982/catapult
 def testNoPathReturnsNone(self):
     self.assertEqual(util.GetBuildDirFromHostApkPath(None), None)