Пример #1
0
 def Foreground(self):
     package = self._backend_settings.package
     activity = self._backend_settings.activity
     self.device.StartActivity(intent.Intent(
         package=package,
         activity=activity,
         action=None,
         flags=[intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED]),
                               blocking=False)
     # TODO(crbug.com/601052): The following waits for any UI node for the
     # package launched to appear on the screen. When the referenced bug is
     # fixed, remove this workaround and just switch blocking above to True.
     app_ui.AppUi(self.device, package).WaitForUiNode(package=package)
Пример #2
0
 def Foreground(self):
   package = self._backend_settings.package
   activity = self._backend_settings.activity
   self.presentation.device.StartActivity(
       intent.Intent(package=package,
                     activity=activity,
                     action=None,
                     flags=[intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED]),
       blocking=False)
   # TODO(crbug.com/601052): The following waits for any UI node for the
   # package launched to appear on the screen. When the referenced bug is
   # fixed, remove this workaround and just switch blocking above to True.
   try:
     app_ui.AppUi(self.presentation.device).WaitForUiNode(package=package)
   except Exception:
     raise exceptions.BrowserGoneException(self.browser,
         'Timed out waiting for browser to come back foreground.')
Пример #3
0
 def GetAppUi(self):
     if self._app_ui is None:
         self._app_ui = app_ui.AppUi(self.device,
                                     self._start_intent.package)
     return self._app_ui
 def GetSystemUi(self):
     if self._system_ui is None:
         self._system_ui = app_ui.AppUi(self.device, 'com.android.systemui')
     return self._system_ui
Пример #5
0
 def GetAppUi(self):
     if self._app_ui is None:
         self._app_ui = app_ui.AppUi(self.device, package=self.package)
     return self._app_ui
Пример #6
0
 def setUp(self):
     self.device = mock.Mock()
     self.device.pixel_density = 320  # Each dp pixel is 2 real pixels.
     self.app = app_ui.AppUi(self.device, package='com.example.app')
     self._setMockXmlScreenshots([MOCK_XML_LOADED])