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

Unified Diff: components/scheduler/renderer/renderer_scheduler_impl_unittest.cc

Issue 1914143002: Experimental 'purging and suspending' backgrounded tabs behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on haraken's review Created 4 years, 7 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
Index: components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
diff --git a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
index f58100c3feca527f7af0ca815e0dc2b5400d9efc..80499060873fc4dde86612a7a3bc1d9ae646291d 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -2124,6 +2124,24 @@ TEST_F(RendererSchedulerImplTest, MultipleSuspendsNeedMultipleResumes) {
testing::ElementsAre(std::string("T1"), std::string("T2")));
}
+TEST_F(RendererSchedulerImplTest, SuspendRendererWhenBackgrounded) {
+ // Assume that the renderer is backgrounded.
+ scheduler_->OnRendererBackgrounded();
+
+ // Tasks don't fire when the renderer is suspended.
+ std::vector<std::string> run_order;
+ PostTestTasks(&run_order, "T1 T2");
+ scheduler_->SuspendRenderer();
+ RunUntilIdle();
+ EXPECT_TRUE(run_order.empty());
+
+ // The queued tasks fire when the tab goes foregrounded.
+ scheduler_->OnRendererForegrounded();
+ RunUntilIdle();
+ EXPECT_THAT(run_order,
+ testing::ElementsAre(std::string("T1"), std::string("T2")));
+}
+
TEST_F(RendererSchedulerImplTest, UseCaseToString) {
CheckAllUseCaseToString();
}
« no previous file with comments | « components/scheduler/renderer/renderer_scheduler_impl.cc ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698