def initialize(self): """Init method""" super(desktopui_ScreenLocker, self).initialize() DBusGMainLoop(set_as_default=True) self.player = input_playback.InputPlayback() self.player.emulate(input_type='keyboard') self.player.find_connected_inputs()
def warmup(self): """Test setup.""" # Emulate keyboard to play back shortcuts and navigate. # See input_playback README. self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs()
def warmup(self): """Test setup.""" # Emulate a keyboard for later ChromeVox toggle (if needed). # See input_playback. The keyboard is used to play back shortcuts. self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs()
def form_pages(bindir, random_ratio): """Creates pages with pending form data and checks OOM. Args: bindir: path to the test directory. random_ratio: the ratio of random data size : all data size """ player = input_playback.InputPlayback() player.emulate(input_type='keyboard') player.find_connected_inputs() def create_form_page(cr, size_mb, bindir): """Creates a page with pending form data.""" tab = create_alloc_page(cr, 'form.html', size_mb, random_ratio, bindir) # Presses tab to focus on the first interactive element. player.blocking_playback_of_default_file(input_type='keyboard', filename='keyboard_tab') # Fills the form. player.blocking_playback_of_default_file(input_type='keyboard', filename='keyboard_a') ret = create_pages_and_check_oom(create_form_page, get_alloc_size_per_page(), bindir) player.close() return ret
def initialize(self, **kwargs): """Emulate a keyboard in order to play back the screenshot shortcut.""" self._initialize_test_constants() super(policy_DisableScreenshots, self).initialize(**kwargs) self.player = input_playback.InputPlayback() self.player.emulate(input_type='keyboard') self.player.find_connected_inputs()
def _check_url_for_rlz(self, cr): """ Does a Google search and ensures there is an rlz parameter. @param cr: Chrome instance. """ timeout_minutes = 2 timeout = time.time() + 60 * timeout_minutes # Setup a keyboard emulator to open new tabs and type a search. with input_playback.InputPlayback() as player: player.emulate(input_type='keyboard') player.find_connected_inputs() while True: # Open a new tab, search in the omnibox. player.blocking_playback_of_default_file( input_type='keyboard', filename='keyboard_ctrl+t') player.blocking_playback_of_default_file( input_type='keyboard', filename='keyboard_b+a+d+enter') logging.info(cr.browser.tabs[-1].url) if 'rlz=' in cr.browser.tabs[-1].url: break else: if time.time() > timeout: raise error.TestFail('RLZ ping did not send in %d ' 'minutes.' % timeout_minutes) time.sleep(10)
def __init__(self): """Prepare an emulated keyboard device.""" self.dirname = os.path.dirname(__file__) # Create an emulated keyboard device. self.keyboard = input_playback.InputPlayback() self.keyboard.emulate(input_type=_KEYBOARD) self.keyboard.find_connected_inputs()
def warmup(self): """Test setup.""" # Emulate keyboard. # See input_playback. The keyboard is used to play back shortcuts. self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs()
def set_fullscreen(self): """Sends F4 keyevent to set fullscreen.""" input_player = input_playback.InputPlayback() input_player.emulate(input_type='keyboard') input_player.find_connected_inputs() input_player.blocking_playback_of_default_file( input_type='keyboard', filename='keyboard_f4')
def capture_screenshot(self, filepath): """ Take a screenshot of the App Launcher page. Implements the abstract method capture_screenshot @param filepath: string, Complete path to save the screenshot to. """ # Login and load the default apps with chrome.Chrome(disable_default_apps=False): # Setup the keyboard file's paths property_file = os.path.join(self.bindir, self._KEYBOARD_PROP) playback_file = os.path.join(self.bindir, self._KEYBOARD_PLAYBACK) # Setup and playback the keyboard commands to open the launcher with input_playback.InputPlayback() as player: player.emulate('keyboard', property_file) player.find_connected_inputs() player.blocking_playback(playback_file, 'keyboard') # Take a screenshot and crop to just the launcher w, h = graphics_utils.get_internal_resolution() upper_x = (w - self.launcher_width) / 2 upper_y = (h - self.launcher_height) / 2 box = (upper_x, upper_y, upper_x + self.launcher_width, upper_y + self.launcher_height) graphics_utils.take_screenshot_crop(filepath, box)
def initialize(self, **kwargs): """ Emulate a keyboard and initialize enterprise policy base. """ super(policy_KeyboardDefaultToFunctionKeys, self).initialize(**kwargs) self.player = input_playback.InputPlayback() self.player.emulate(input_type='keyboard') self.player.find_connected_inputs()
def __init__(self): """Prepare an emulated stylus device based on the internal display.""" self.dirname = os.path.dirname(__file__) width, height = graphics_utils.get_internal_resolution() logging.info('internal display W = %d H = %d ', width, height) # Skip the test if there is no internal display if width == -1: raise error.TestNAError('No internal display') # Enlarge resolution of the emulated stylus. self.width = width * 10 self.height = height * 10 stylus_template = os.path.join(self.dirname, _STYLUS_TEMPLATE) self.replace_with_prefix(stylus_template, _STYLUS_PROPERTY, _PREFIX_RESOLUTION, self.width, self.height) # Create an emulated stylus device. self.stylus = input_playback.InputPlayback() self.stylus.emulate(input_type=_STYLUS_DEVICE, property_file=_STYLUS_PROPERTY) self.stylus.find_connected_inputs()
def warmup(self, mouse_props=None): """Test setup. Instantiate player object to find touch devices, if any. These devices can be used for playback later. Emulate a USB mouse if a property file is provided. Check if the inputcontrol script is avaiable on the disk. @param mouse_props: optional property file for a mouse to emulate. Created using 'evemu-describe /dev/input/X'. """ self.player = input_playback.InputPlayback() if mouse_props: self.player.emulate(input_type='mouse', property_file=mouse_props) self.player.find_connected_inputs() self._autotest_ext = None self._has_inputcontrol = os.path.isfile(self._INPUTCONTROL) self._platform = utils.get_board()
def initialize(self, raise_error_on_hang=False, *args, **kwargs): """Initial state checker and report initial value to perf dashboard.""" self._GSC = GraphicsStateChecker( raise_error_on_hang=raise_error_on_hang, run_on_sw_rasterizer=utils.is_virtual_machine()) self.output_perf_value(description='Timeout_Reboot', value=1, units='count', higher_is_better=False, replace_existing_values=True) # Enable the graphics tests to use keyboard interaction. self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs() if hasattr(super(GraphicsTest, self), "initialize"): test_utils._cherry_pick_call( super(GraphicsTest, self).initialize, *args, **kwargs)
def initialize(self): self.GSC = graphics_utils.GraphicsStateChecker() self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs()
def initialize(self): super(graphics_VTSwitch, self).initialize() self._player = input_playback.InputPlayback() self._player.emulate(input_type='keyboard') self._player.find_connected_inputs()