Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py
diff --git a/telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py b/telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py
index 022bd291bac5a1972e6d9b16b393adba237f0e01..ab27d535f3c3690f0cada0d5ca1d208d005f6827 100644
--- a/telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py
+++ b/telemetry/telemetry/internal/backends/chrome_inspector/inspector_backend.py
@@ -275,6 +275,75 @@ class InspectorBackend(object):
}
return self._runtime.RunInspectorCommand(scroll_command, timeout)
+ @_HandleInspectorWebSocketExceptions
+ def DispatchKeyEvent(self, keyEventType='char', modifiers=None,
+ timestamp=None, text=None, unmodifiedText=None,
+ keyIdentifier=None, domCode=None, domKey=None,
+ windowsVirtualKeyCode=None, nativeVirtualKeyCode=None,
+ autoRepeat=None, isKeypad=None, isSystemKey=None,
+ timeout=60):
+ """Dispatches a key event to the page.
+
+ Args:
+ type: Type of the key event. Allowed values: 'keyDown', 'keyUp',
+ 'rawKeyDown', 'char'.
+ modifiers: Bit field representing pressed modifier keys. Alt=1, Ctrl=2,
+ Meta/Command=4, Shift=8 (default: 0).
+ timestamp: Time at which the event occurred. Measured in UTC time in
+ seconds since January 1, 1970 (default: current time).
+ text: Text as generated by processing a virtual key code with a keyboard
+ layout. Not needed for for keyUp and rawKeyDown events (default: '').
+ unmodifiedText: Text that would have been generated by the keyboard if no
+ modifiers were pressed (except for shift). Useful for shortcut
+ (accelerator) key handling (default: "").
+ keyIdentifier: Unique key identifier (e.g., 'U+0041') (default: '').
+ windowsVirtualKeyCode: Windows virtual key code (default: 0).
+ nativeVirtualKeyCode: Native virtual key code (default: 0).
+ autoRepeat: Whether the event was generated from auto repeat (default:
+ False).
+ isKeypad: Whether the event was generated from the keypad (default:
+ False).
+ isSystemKey: Whether the event was a system key event (default: False).
+
+ Raises:
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ """
+ params = {
+ 'type': keyEventType,
+ }
+
+ if modifiers is not None:
+ params['modifiers'] = modifiers
+ if timestamp is not None:
+ params['timestamp'] = timestamp
+ if text is not None:
+ params['text'] = text
+ if unmodifiedText is not None:
+ params['unmodifiedText'] = unmodifiedText
+ if keyIdentifier is not None:
+ params['keyIdentifier'] = keyIdentifier
+ if domCode is not None:
+ params['code'] = domCode
+ if domKey is not None:
+ params['key'] = domKey
+ if windowsVirtualKeyCode is not None:
+ params['windowsVirtualKeyCode'] = windowsVirtualKeyCode
+ if nativeVirtualKeyCode is not None:
+ params['nativeVirtualKeyCode'] = nativeVirtualKeyCode
+ if autoRepeat is not None:
+ params['autoRepeat'] = autoRepeat
+ if isKeypad is not None:
+ params['isKeypad'] = isKeypad
+ if isSystemKey is not None:
+ params['isSystemKey'] = isSystemKey
+
+ key_command = {
+ 'method': 'Input.dispatchKeyEvent',
+ 'params': params
+ }
+ return self._runtime.RunInspectorCommand(key_command, timeout)
+
# Methods used internally by other backends.
def _HandleInspectorDomainNotification(self, res):

Powered by Google App Engine
This is Rietveld 408576698