Commit eb63efb4 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Call OnFirstResponderChanged to simulate the View having focus.

Moving MouseLock emulation into the browser found that
the RenderWidgetHostViewMac::HasFocus always returned false
for WebTests. It is reasonable to simulate the view having
focus in WebTests so call OnFirstResponderChanged appropriately.

BUG=1097816

Change-Id: Id0a87cea174ac308bf73103a90fff678b30d429e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459568Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814913}
parent 018a7103
...@@ -164,17 +164,17 @@ void WebTestShellPlatformDelegate::ActivateContents(Shell* shell, ...@@ -164,17 +164,17 @@ void WebTestShellPlatformDelegate::ActivateContents(Shell* shell,
for (Shell* window : Shell::windows()) { for (Shell* window : Shell::windows()) {
if (window != shell) { if (window != shell) {
WebContents* other_top_contents = window->web_contents(); WebContents* other_top_contents = window->web_contents();
RenderWidgetHost* other_main_widget = auto* other_rwhv_mac = static_cast<RenderWidgetHostViewMac*>(
other_top_contents->GetMainFrame()->GetView()->GetRenderWidgetHost(); other_top_contents->GetMainFrame()->GetView());
other_main_widget->Blur(); other_rwhv_mac->OnFirstResponderChanged(false);
other_main_widget->SetActive(false); other_rwhv_mac->GetRenderWidgetHost()->SetActive(false);
} }
} }
RenderWidgetHost* main_widget = auto* top_rwhv_mac = static_cast<RenderWidgetHostViewMac*>(
top_contents->GetMainFrame()->GetView()->GetRenderWidgetHost(); top_contents->GetMainFrame()->GetView());
main_widget->Focus(); top_rwhv_mac->OnFirstResponderChanged(true);
main_widget->SetActive(true); top_rwhv_mac->GetRenderWidgetHost()->SetActive(true);
activated_headless_shell_ = shell; activated_headless_shell_ = shell;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment