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

Side by Side Diff: content/renderer/scheduler/renderer_scheduler_impl_unittest.cc

Issue 969373002: [content]: Add CanExceedIdleDeadlineIfRequired function to RendererScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@long_idle_5
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/scheduler/renderer_scheduler_impl.h" 5 #include "content/renderer/scheduler/renderer_scheduler_impl.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "cc/output/begin_frame_args.h" 8 #include "cc/output/begin_frame_args.h"
9 #include "cc/test/ordered_simple_task_runner.h" 9 #include "cc/test/ordered_simple_task_runner.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 scheduler_->BeginFrameNotExpectedSoon(); 1157 scheduler_->BeginFrameNotExpectedSoon();
1158 RunUntilIdle(); 1158 RunUntilIdle();
1159 EXPECT_EQ(0, run_count); 1159 EXPECT_EQ(0, run_count);
1160 1160
1161 // The long idle period should start after the touchstart policy has finished. 1161 // The long idle period should start after the touchstart policy has finished.
1162 clock_->AdvanceNow(priority_escalation_after_input_duration()); 1162 clock_->AdvanceNow(priority_escalation_after_input_duration());
1163 RunUntilIdle(); 1163 RunUntilIdle();
1164 EXPECT_EQ(1, run_count); 1164 EXPECT_EQ(1, run_count);
1165 } 1165 }
1166 1166
1167 TEST_F(RendererSchedulerImplTest, TestIsMaximumIdleDeadline) {
1168 base::TimeTicks short_deadline =
1169 clock_->Now() + base::TimeDelta::FromMilliseconds(10);
1170 EXPECT_FALSE(scheduler_->IsMaximumIdleDeadline(short_deadline));
1171 base::TimeTicks long_deadline =
1172 clock_->Now() + maximum_idle_period_duration();
1173 EXPECT_TRUE(scheduler_->IsMaximumIdleDeadline(long_deadline));
1174 base::TimeTicks within_slop_long_deadline =
1175 clock_->Now() - base::TimeDelta::FromMilliseconds(1) +
1176 maximum_idle_period_duration();
1177 EXPECT_TRUE(scheduler_->IsMaximumIdleDeadline(within_slop_long_deadline));
1178 }
1179
1167 } // namespace content 1180 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698