* test: wait for an active window before sending menu shortcuts
On Windows and Linux, views hands accelerators only to the active
window (View::CanHandleAccelerators). The setIgnoreMenuShortcuts specs
waited for page or DevTools focus, which can be set inside an inactive
window, or for no focus at all, so an honored F13 could miss the menu
and the spec timed out waiting for it. Focus the window and wait for
isFocused() before each press.
The CDP keyUp's answer is what orders the count after the keyDown's
menu dispatch: the widget acks the events in order, and the browser
offers an unhandled keyDown to the menu while it handles that ack.
This only holds when both events reach the same widget, but the keyDown
went through sendInputEvent to the main widget, while CDP targets the
focused frame. Send the keyDown through CDP as well, with a native key
code so that it isn't marked skip_if_unhandled. Read the count as soon
as the keyUp is answered instead of polling for it, and wait for the
webview guest to have focus.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: keep menu shortcut windows visible and active
The browser doesn't offer keys from a hidden widget to the menu
(RenderWidgetHostImpl::OnKeyboardEventAck checks IsHidden()). On
Windows, native occlusion marks a covered window hidden and shows it
again only after a timer and a posted task, so a press sent right after
window.focus() raises a covered window could be dropped. Keep the shown
windows always on top on Windows, as the visibility specs do, and wait
for the page to report that it is visible before each press.
On macOS, window.focus() activates the app only when no other app is
frontmost, so the isFocused() wait could time out. Take activation with
app.focus({ steal: true }) first, as the webview specs do.
Also correct the comment on the native key code: off macOS, any
non-zero code works.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: simplify the menu shortcut specs
The webview spec activated the window before each press, and then
sendShortcut() activated it again under a different condition. Focus
the guest inside sendShortcut() instead, once the window is active, so
activation happens in one place. Set the Windows alwaysOnTop option
from one describe-level const, next to the reason for it.
The docked DevTools spec waited for devtools-focused and passed
activate: true, which is the default and which docked DevTools ignore.
Neither the CDP target nor the menu depends on DevTools focus, and
sendShortcut() already waits for an active window and a visible page
before each press, so drop both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>