Fix media keys to use new key strings and codes (#164)

VolumeUp, VolumeDown, and VolumeMute were changed to AudioVolumeUp, AudioVolumeDown, and AudioVolumeMute

The media keys like MediaTrackNext were also missing, so I added them.
This commit is contained in:
JoelEinbinder 2017-07-28 11:38:30 -07:00 committed by Andrey Lushnikov
parent 1998104489
commit 3c75767288

View File

@ -31,7 +31,7 @@ class Keyboard {
* @return {!Promise} * @return {!Promise}
*/ */
async down(key, options) { async down(key, options) {
let {text} = options || {}; let { text } = options || {};
this._modifiers |= this._modifierBit(key); this._modifiers |= this._modifierBit(key);
await this._client.send('Input.dispatchKeyEvent', { await this._client.send('Input.dispatchKeyEvent', {
type: text ? 'keyDown' : 'rawKeyDown', type: text ? 'keyDown' : 'rawKeyDown',
@ -244,9 +244,13 @@ let keys = {
'F24': 135, 'F24': 135,
'NumLock': 144, 'NumLock': 144,
'ScrollLock': 145, 'ScrollLock': 145,
'VolumeMute': 181, 'AudioVolumeMute': 173,
'VolumeDown': 182, 'AudioVolumeDown': 174,
'VolumeUp': 183, 'AudioVolumeUp': 175,
'MediaTrackNext': 176,
'MediaTrackPrevious': 177,
'MediaStop': 178,
'MediaPlayPause': 179,
';': 186, ';': 186,
':': 186, ':': 186,
'=': 187, '=': 187,
@ -290,6 +294,6 @@ function codeForKey(key) {
return 0; return 0;
} }
module.exports = {Keyboard, Mouse}; module.exports = { Keyboard, Mouse };
helper.tracePublicAPI(Keyboard); helper.tracePublicAPI(Keyboard);
helper.tracePublicAPI(Mouse); helper.tracePublicAPI(Mouse);