Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(909)

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 2730203002: Revert of Discard compositor frames from unloaded web content (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 7b74276b680d62098c1593060e633c215d77d2d1..439ffccedb40398ae6ee560f5d6bc3cab984af69 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -1242,7 +1242,7 @@
base::TimeDelta::FromMicroseconds(10));
// Test immediate start and stop, ensuring that the timeout doesn't fire.
- host_->StartNewContentRenderingTimeout(0);
+ host_->StartNewContentRenderingTimeout();
host_->OnFirstPaintAfterLoad();
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
@@ -1254,7 +1254,7 @@
// Test that the timer doesn't fire if it receives a stop before
// a start.
host_->OnFirstPaintAfterLoad();
- host_->StartNewContentRenderingTimeout(0);
+ host_->StartNewContentRenderingTimeout();
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
TimeDelta::FromMicroseconds(20));
@@ -1263,45 +1263,12 @@
EXPECT_FALSE(host_->new_content_rendering_timeout_fired());
// Test with a long delay to ensure that it does fire this time.
- host_->StartNewContentRenderingTimeout(0);
+ host_->StartNewContentRenderingTimeout();
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
TimeDelta::FromMicroseconds(20));
base::RunLoop().Run();
EXPECT_TRUE(host_->new_content_rendering_timeout_fired());
-}
-
-// This tests that a compositor frame received with a stale content source ID
-// in its metadata is properly discarded.
-TEST_F(RenderWidgetHostTest, SwapCompositorFrameWithBadSourceId) {
- host_->StartNewContentRenderingTimeout(100);
- host_->OnFirstPaintAfterLoad();
-
- // First swap a frame with an invalid ID.
- cc::CompositorFrame frame;
- frame.metadata.content_source_id = 99;
- host_->OnMessageReceived(ViewHostMsg_SwapCompositorFrame(
- 0, 0, frame, std::vector<IPC::Message>()));
- EXPECT_FALSE(
- static_cast<TestView*>(host_->GetView())->did_swap_compositor_frame());
- static_cast<TestView*>(host_->GetView())->reset_did_swap_compositor_frame();
-
- // Test with a valid content ID as a control.
- frame.metadata.content_source_id = 100;
- host_->OnMessageReceived(ViewHostMsg_SwapCompositorFrame(
- 0, 0, frame, std::vector<IPC::Message>()));
- EXPECT_TRUE(
- static_cast<TestView*>(host_->GetView())->did_swap_compositor_frame());
- static_cast<TestView*>(host_->GetView())->reset_did_swap_compositor_frame();
-
- // We also accept frames with higher content IDs, to cover the case where
- // the browser process receives a compositor frame for a new page before
- // the corresponding DidCommitProvisionalLoad (it's a race).
- frame.metadata.content_source_id = 101;
- host_->OnMessageReceived(ViewHostMsg_SwapCompositorFrame(
- 0, 0, frame, std::vector<IPC::Message>()));
- EXPECT_TRUE(
- static_cast<TestView*>(host_->GetView())->did_swap_compositor_frame());
}
TEST_F(RenderWidgetHostTest, TouchEmulator) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698