Commit cb82e2e4 authored by jonross's avatar jonross Committed by Commit Bot

Update Chrome callsites that use MainThreadFrameObserver

MainThreadFrameObserver does not guarantee that a compositor frame was actually
submitted. It however does synchronize the Renderer's main thread, which allows
for syncing Javascript execution in tests.

This updates two tests in chrome/browser to use RenderFrameSubmissionObserver
for synchronizing on compositor frame submission. As well as InputEventAckWaiter
for synchronizing on input event processing.

TEST=WebViewTest.InterstitialPageFocusedWidget,
WebViewBrowserPluginSpecificInteractiveTest.EnsureFocusSynced

Bug: 862683
Change-Id: Iae40b92dedf656898b9e77c6529ef118d89e0a6e
Reviewed-on: https://chromium-review.googlesource.com/1133960Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574335}
parent c4149316
......@@ -1898,6 +1898,7 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_InterstitialPageFocusedWidget) {
interstitial_main_frame->GetRenderViewHost()->GetWidget();
content::WaitForHitTestDataOrChildSurfaceReady(interstitial_main_frame);
content::RenderFrameSubmissionObserver frame_observer(guest_web_contents);
EXPECT_NE(interstitial_widget,
content::GetFocusedRenderWidgetHost(guest_web_contents));
......@@ -1912,16 +1913,15 @@ IN_PROC_BROWSER_TEST_F(WebViewTest, MAYBE_InterstitialPageFocusedWidget) {
content::RouteMouseEvent(outer_web_contents, &event);
// Wait a frame.
content::MainThreadFrameObserver observer(interstitial_widget);
observer.Wait();
frame_observer.WaitForAnyFrameSubmission();
// Send mouse up.
content::InputEventAckWaiter waiter(interstitial_widget,
blink::WebInputEvent::kMouseUp);
event.SetType(blink::WebInputEvent::kMouseUp);
event.SetPositionInWidget(10, 10);
content::RouteMouseEvent(outer_web_contents, &event);
// Wait another frame.
observer.Wait();
waiter.Wait();
EXPECT_EQ(interstitial_widget,
content::GetFocusedRenderWidgetHost(guest_web_contents));
......
......@@ -1165,13 +1165,11 @@ IN_PROC_BROWSER_TEST_F(WebViewBrowserPluginSpecificInteractiveTest,
content::WebContents* embedder_web_contents = GetFirstAppWindowWebContents();
content::WebContents* guest_web_contents =
GetGuestViewManager()->WaitForSingleGuestCreated();
content::MainThreadFrameObserver embedder_observer(
embedder_web_contents->GetMainFrame()->GetView()->GetRenderWidgetHost());
content::MainThreadFrameObserver guest_observer(
guest_web_contents->GetMainFrame()->GetView()->GetRenderWidgetHost());
embedder_observer.Wait();
guest_observer.Wait();
content::RenderFrameSubmissionObserver embedder_observer(
embedder_web_contents);
content::RenderFrameSubmissionObserver guest_observer(guest_web_contents);
embedder_observer.WaitForMetadataChange();
guest_observer.WaitForMetadataChange();
ExtensionTestMessageListener listener{"WebViewTest.WEBVIEW_LOADED", false};
EXPECT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow()));
......
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