Commit c91bf7a5 authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

presentation feedback: Plumb the feedback to OOPIFs.

Make sure the OOPIF page receives its presentation feedbacks correctly.

BUG=850561

Change-Id: I5570318bc40728a1995870eb19f8fd6050bf0c02
Reviewed-on: https://chromium-review.googlesource.com/1090999
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565512}
parent 32933b4c
......@@ -598,11 +598,13 @@ void RenderWidgetHostViewChildFrame::DidReceiveCompositorFrameAck(
void RenderWidgetHostViewChildFrame::DidPresentCompositorFrame(
uint32_t presentation_token,
const gfx::PresentationFeedback& feedback) {
NOTIMPLEMENTED();
renderer_compositor_frame_sink_->DidPresentCompositorFrame(presentation_token,
feedback);
}
void RenderWidgetHostViewChildFrame::DidDiscardCompositorFrame(
uint32_t presentation_token) {
NOTIMPLEMENTED();
renderer_compositor_frame_sink_->DidDiscardCompositorFrame(
presentation_token);
}
void RenderWidgetHostViewChildFrame::DidCreateNewRendererCompositorFrameSink(
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {
......
......@@ -6,6 +6,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/test/test_timeouts.h"
#include "components/viz/common/surfaces/surface_id.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/web_contents/web_contents_impl.h"
......@@ -75,6 +76,13 @@ class RenderWidgetHostViewChildFrameTest : public ContentBrowserTest {
actual_frame_sink_id_.sink_id());
}
void GiveItSomeTime() {
base::RunLoop run_loop;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
run_loop.Run();
}
void set_expected_frame_sink_id(viz::FrameSinkId frame_sink_id) {
expected_frame_sink_id_ = frame_sink_id;
}
......@@ -182,4 +190,35 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewChildFrameTest, ChildFrameSinkId) {
base::Unretained(this)));
}
// Validate that OOPIFs receive presentation feedbacks.
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewChildFrameTest,
PresentationFeedback) {
base::HistogramTester histogram_tester;
GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
NavigateToURL(shell(), main_url);
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
->GetFrameTree()
->root();
// Load cross-site page into iframe.
GURL cross_site_url(
embedded_test_server()->GetURL("foo.com", "/title2.html"));
NavigateFrameToURL(root->child_at(0), cross_site_url);
auto* child_rwh_impl =
root->child_at(0)->current_frame_host()->GetRenderWidgetHost();
// Hide the frame and make it visible again, to force it to record the
// tab-switch time, which is generated from presentation-feedback.
child_rwh_impl->WasHidden();
child_rwh_impl->WasShown(true /* record_presentation_time */);
// Force the child to submit a new frame.
ASSERT_TRUE(ExecuteScript(root->child_at(0)->current_frame_host(),
"document.write('Force a new frame.');"));
do {
FetchHistogramsFromChildProcesses();
GiveItSomeTime();
} while (histogram_tester.GetAllSamples("MPArch.RWH_TabSwitchPaintDuration")
.size() != 1);
}
} // namespace content
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