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

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

Issue 1895773002: Move responsiblity of tab suspending from renderer to TabManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix time Created 4 years, 8 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 6cd96dcd8cbc458b143e55902b61624115868453..fd5216710fca7726d28ddd5b9a8e925224ccaf79 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -531,11 +531,6 @@ class RendererSchedulerImplTest : public testing::Test {
RendererSchedulerImpl::kIdlePeriodStarvationThresholdMillis);
}
- static base::TimeDelta suspend_timers_when_backgrounded_delay() {
- return base::TimeDelta::FromMilliseconds(
- RendererSchedulerImpl::kSuspendTimersWhenBackgroundedDelayMillis);
- }
-
static base::TimeDelta rails_response_time() {
return base::TimeDelta::FromMilliseconds(
RendererSchedulerImpl::kRailsResponseTimeMillis);
@@ -2090,47 +2085,6 @@ TEST_F(RendererSchedulerImplTest, ShutdownPreventsPostingOfNewTasks) {
EXPECT_TRUE(run_order.empty());
}
-TEST_F(RendererSchedulerImplTest, TestRendererBackgroundedTimerSuspension) {
- scheduler_->SetTimerQueueSuspensionWhenBackgroundedEnabled(true);
-
- std::vector<std::string> run_order;
- PostTestTasks(&run_order, "T1 T2");
-
- // The background signal will not immediately suspend the timer queue.
- scheduler_->OnRendererBackgrounded();
- RunUntilIdle();
- EXPECT_THAT(run_order,
- testing::ElementsAre(std::string("T1"), std::string("T2")));
-
- run_order.clear();
- PostTestTasks(&run_order, "T3");
- RunUntilIdle();
- EXPECT_THAT(run_order, testing::ElementsAre(std::string("T3")));
-
- // Advance the time until after the scheduled timer queue suspension.
- run_order.clear();
- clock_->Advance(suspend_timers_when_backgrounded_delay() +
- base::TimeDelta::FromMilliseconds(10));
- RunUntilIdle();
- ASSERT_TRUE(run_order.empty());
-
- // Timer tasks should be suspended until the foregrounded signal.
- PostTestTasks(&run_order, "T4 T5");
- RunUntilIdle();
- EXPECT_TRUE(run_order.empty());
-
- scheduler_->OnRendererForegrounded();
- RunUntilIdle();
- EXPECT_THAT(run_order,
- testing::ElementsAre(std::string("T4"), std::string("T5")));
-
- // Subsequent timer tasks should fire as usual.
- run_order.clear();
- PostTestTasks(&run_order, "T6");
- RunUntilIdle();
- EXPECT_THAT(run_order, testing::ElementsAre(std::string("T6")));
-}
-
TEST_F(RendererSchedulerImplTest,
ExpensiveLoadingTasksNotBlockedTillFirstBeginMainFrame) {
std::vector<std::string> run_order;

Powered by Google App Engine
This is Rietveld 408576698