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

Unified Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (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
Index: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
index 779b930a1c3da6b0e21188ce05df14adbc6ea88d..42621bd3de11f61d0e96c495166e0ed57a15030e 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -76,8 +76,9 @@ void RepostingIdleTestTask(SingleThreadIdleTaskRunner* idle_task_runner,
base::TimeTicks deadline) {
if ((*run_count + 1) < max_idle_task_reposts) {
idle_task_runner->PostIdleTask(
- FROM_HERE, base::Bind(&RepostingIdleTestTask,
- base::Unretained(idle_task_runner), run_count));
+ FROM_HERE,
+ base::Bind(&RepostingIdleTestTask, base::Unretained(idle_task_runner),
+ run_count));
}
(*run_count)++;
}
@@ -91,9 +92,10 @@ void RepostingUpdateClockIdleTestTask(
base::TimeTicks deadline) {
if ((*run_count + 1) < max_idle_task_reposts) {
idle_task_runner->PostIdleTask(
- FROM_HERE, base::Bind(&RepostingUpdateClockIdleTestTask,
- base::Unretained(idle_task_runner), run_count,
- clock, advance_time, deadlines));
+ FROM_HERE,
+ base::Bind(&RepostingUpdateClockIdleTestTask,
+ base::Unretained(idle_task_runner), run_count, clock,
+ advance_time, deadlines));
}
deadlines->push_back(deadline);
(*run_count)++;
@@ -700,9 +702,10 @@ TEST_F(RendererSchedulerImplTest, TestRentrantTask) {
int count = 0;
std::vector<int> run_order;
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(AppendToVectorReentrantTask,
- base::RetainedRef(default_task_runner_), &run_order,
- &count, 5));
+ FROM_HERE,
+ base::Bind(AppendToVectorReentrantTask,
+ base::RetainedRef(default_task_runner_), &run_order, &count,
+ 5));
RunUntilIdle();
EXPECT_THAT(run_order, testing::ElementsAre(0, 1, 2, 3, 4));
@@ -749,8 +752,9 @@ TEST_F(RendererSchedulerImplTest, TestRepostingIdleTask) {
max_idle_task_reposts = 2;
idle_task_runner_->PostIdleTask(
- FROM_HERE, base::Bind(&RepostingIdleTestTask,
- base::RetainedRef(idle_task_runner_), &run_count));
+ FROM_HERE,
+ base::Bind(&RepostingIdleTestTask, base::RetainedRef(idle_task_runner_),
+ &run_count));
EnableIdleTasks();
RunUntilIdle();
EXPECT_EQ(1, run_count);
@@ -897,8 +901,9 @@ TEST_F(RendererSchedulerImplTest,
SimulateCompositorGestureStart(TouchEventPolicy::SEND_TOUCH_START);
base::TimeTicks loop_end_time =
- clock_->NowTicks() + base::TimeDelta::FromMilliseconds(
- UserModel::kMedianGestureDurationMillis * 2);
+ clock_->NowTicks() +
+ base::TimeDelta::FromMilliseconds(
+ UserModel::kMedianGestureDurationMillis * 2);
// The UseCase::COMPOSITOR_GESTURE usecase initially deprioritizes compositor
// tasks (see TestCompositorPolicy_CompositorHandlesInput_WithTouchHandler)
@@ -1638,9 +1643,10 @@ TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
scheduler_->SetHasVisibleRenderWidgetWithTouchHandler(true);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
- SimulateInputType::None, &is_anticipated_before,
- &is_anticipated_after));
+ FROM_HERE,
+ base::Bind(&AnticipationTestTask, scheduler_.get(),
+ SimulateInputType::None, &is_anticipated_before,
+ &is_anticipated_after));
RunUntilIdle();
// In its default state, without input receipt, the scheduler should indicate
// that no high-priority is anticipated.
@@ -1648,13 +1654,15 @@ TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
EXPECT_FALSE(is_anticipated_after);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
- SimulateInputType::TouchStart,
- &is_anticipated_before, &is_anticipated_after));
+ FROM_HERE,
+ base::Bind(&AnticipationTestTask, scheduler_.get(),
+ SimulateInputType::TouchStart, &is_anticipated_before,
+ &is_anticipated_after));
bool dummy;
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
- SimulateInputType::TouchEnd, &dummy, &dummy));
+ FROM_HERE,
+ base::Bind(&AnticipationTestTask, scheduler_.get(),
+ SimulateInputType::TouchEnd, &dummy, &dummy));
default_task_runner_->PostTask(
FROM_HERE,
base::Bind(&AnticipationTestTask, scheduler_.get(),
@@ -1672,9 +1680,10 @@ TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
clock_->Advance(priority_escalation_after_input_duration() * 2);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
- SimulateInputType::None, &is_anticipated_before,
- &is_anticipated_after));
+ FROM_HERE,
+ base::Bind(&AnticipationTestTask, scheduler_.get(),
+ SimulateInputType::None, &is_anticipated_before,
+ &is_anticipated_after));
RunUntilIdle();
// Without additional input, the scheduler should go into NONE
// use case but with scrolling expected where high-priority work is still
@@ -1686,9 +1695,10 @@ TEST_F(RendererSchedulerImplTest, TestIsHighPriorityWorkAnticipated) {
clock_->Advance(subsequent_input_expected_after_input_duration() * 2);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&AnticipationTestTask, scheduler_.get(),
- SimulateInputType::None, &is_anticipated_before,
- &is_anticipated_after));
+ FROM_HERE,
+ base::Bind(&AnticipationTestTask, scheduler_.get(),
+ SimulateInputType::None, &is_anticipated_before,
+ &is_anticipated_after));
RunUntilIdle();
// Eventually the scheduler should go into the default use case where
// high-priority work is no longer anticipated.
@@ -1703,27 +1713,30 @@ TEST_F(RendererSchedulerImplTest, TestShouldYield) {
bool should_yield_after = false;
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
- base::RetainedRef(default_task_runner_), false,
- &should_yield_before, &should_yield_after));
+ FROM_HERE,
+ base::Bind(&PostingYieldingTestTask, scheduler_.get(),
+ base::RetainedRef(default_task_runner_), false,
+ &should_yield_before, &should_yield_after));
RunUntilIdle();
// Posting to default runner shouldn't cause yielding.
EXPECT_FALSE(should_yield_before);
EXPECT_FALSE(should_yield_after);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
- base::RetainedRef(compositor_task_runner_), false,
- &should_yield_before, &should_yield_after));
+ FROM_HERE,
+ base::Bind(&PostingYieldingTestTask, scheduler_.get(),
+ base::RetainedRef(compositor_task_runner_), false,
+ &should_yield_before, &should_yield_after));
RunUntilIdle();
// Posting while not mainthread scrolling shouldn't cause yielding.
EXPECT_FALSE(should_yield_before);
EXPECT_FALSE(should_yield_after);
default_task_runner_->PostTask(
- FROM_HERE, base::Bind(&PostingYieldingTestTask, scheduler_.get(),
- base::RetainedRef(compositor_task_runner_), true,
- &should_yield_before, &should_yield_after));
+ FROM_HERE,
+ base::Bind(&PostingYieldingTestTask, scheduler_.get(),
+ base::RetainedRef(compositor_task_runner_), true,
+ &should_yield_before, &should_yield_after));
RunUntilIdle();
// We should be able to switch to compositor priority mid-task.
EXPECT_FALSE(should_yield_before);
@@ -2057,9 +2070,10 @@ TEST_F(RendererSchedulerImplWithMessageLoopTest,
EnableIdleTasks();
RunUntilIdle();
// Note we expect task 3 to run last because it's non-nestable.
- EXPECT_THAT(order, testing::ElementsAre(std::string("1"), std::string("2"),
- std::string("4"), std::string("5"),
- std::string("3")));
+ EXPECT_THAT(
+ order,
+ testing::ElementsAre(std::string("1"), std::string("2"), std::string("4"),
+ std::string("5"), std::string("3")));
}
TEST_F(RendererSchedulerImplTest, TestLongIdlePeriod) {
@@ -2248,8 +2262,9 @@ TEST_F(RendererSchedulerImplTest, TestRendererHiddenIdlePeriod) {
max_idle_task_reposts = 2;
idle_task_runner_->PostIdleTask(
- FROM_HERE, base::Bind(&RepostingIdleTestTask,
- base::RetainedRef(idle_task_runner_), &run_count));
+ FROM_HERE,
+ base::Bind(&RepostingIdleTestTask, base::RetainedRef(idle_task_runner_),
+ &run_count));
// Renderer should start in visible state.
RunUntilIdle();
@@ -2266,8 +2281,9 @@ TEST_F(RendererSchedulerImplTest, TestRendererHiddenIdlePeriod) {
// idle tasks when hidden (plus some slack) - idle period should have ended.
max_idle_task_reposts = 3;
idle_task_runner_->PostIdleTask(
- FROM_HERE, base::Bind(&RepostingIdleTestTask,
- base::RetainedRef(idle_task_runner_), &run_count));
+ FROM_HERE,
+ base::Bind(&RepostingIdleTestTask, base::RetainedRef(idle_task_runner_),
+ &run_count));
clock_->Advance(end_idle_when_hidden_delay() +
base::TimeDelta::FromMilliseconds(10));
RunUntilIdle();
@@ -2837,14 +2853,16 @@ TEST_F(RendererSchedulerImplTest, ModeratelyExpensiveTimer_NotBlocked) {
scheduler_->WillBeginFrame(begin_frame_args);
compositor_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RendererSchedulerImplTest::
- SimulateMainThreadInputHandlingCompositorTask,
- base::Unretained(this),
- base::TimeDelta::FromMilliseconds(8)));
+ FROM_HERE,
+ base::Bind(&RendererSchedulerImplTest::
+ SimulateMainThreadInputHandlingCompositorTask,
+ base::Unretained(this),
+ base::TimeDelta::FromMilliseconds(8)));
timer_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
- base::Unretained(this),
- base::TimeDelta::FromMilliseconds(4)));
+ FROM_HERE,
+ base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
+ base::Unretained(this),
+ base::TimeDelta::FromMilliseconds(4)));
RunUntilIdle();
EXPECT_TRUE(simulate_timer_task_ran_) << " i = " << i;
@@ -2882,9 +2900,10 @@ TEST_F(RendererSchedulerImplTest,
base::Unretained(this),
base::TimeDelta::FromMilliseconds(8)));
timer_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
- base::Unretained(this),
- base::TimeDelta::FromMilliseconds(40)));
+ FROM_HERE,
+ base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
+ base::Unretained(this),
+ base::TimeDelta::FromMilliseconds(40)));
RunUntilIdle();
EXPECT_TRUE(simulate_timer_task_ran_) << " i = " << i;
@@ -2918,14 +2937,16 @@ TEST_F(RendererSchedulerImplTest,
scheduler_->WillBeginFrame(begin_frame_args);
compositor_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RendererSchedulerImplTest::
- SimulateMainThreadInputHandlingCompositorTask,
- base::Unretained(this),
- base::TimeDelta::FromMilliseconds(8)));
+ FROM_HERE,
+ base::Bind(&RendererSchedulerImplTest::
+ SimulateMainThreadInputHandlingCompositorTask,
+ base::Unretained(this),
+ base::TimeDelta::FromMilliseconds(8)));
timer_task_runner_->PostTask(
- FROM_HERE, base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
- base::Unretained(this),
- base::TimeDelta::FromMilliseconds(10)));
+ FROM_HERE,
+ base::Bind(&RendererSchedulerImplTest::SimulateTimerTask,
+ base::Unretained(this),
+ base::TimeDelta::FromMilliseconds(10)));
RunUntilIdle();
EXPECT_EQ(RendererSchedulerImpl::UseCase::MAIN_THREAD_CUSTOM_INPUT_HANDLING,
@@ -3161,8 +3182,9 @@ void SlowCountingTask(size_t* count,
scoped_refptr<base::SingleThreadTaskRunner> timer_queue) {
clock->Advance(base::TimeDelta::FromMilliseconds(task_duration));
if (++(*count) < 500) {
- timer_queue->PostTask(FROM_HERE, base::Bind(SlowCountingTask, count, clock,
- task_duration, timer_queue));
+ timer_queue->PostTask(
+ FROM_HERE,
+ base::Bind(SlowCountingTask, count, clock, task_duration, timer_queue));
}
}
}
@@ -3178,8 +3200,9 @@ TEST_F(RendererSchedulerImplTest,
// With the compositor task taking 10ms, there is not enough time to run this
// 7ms timer task in the 16ms frame.
scheduler_->TimerTaskRunner()->PostTask(
- FROM_HERE, base::Bind(SlowCountingTask, &count, clock_.get(), 7,
- scheduler_->TimerTaskRunner()));
+ FROM_HERE,
+ base::Bind(SlowCountingTask, &count, clock_.get(), 7,
+ scheduler_->TimerTaskRunner()));
for (int i = 0; i < 1000; i++) {
cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
@@ -3241,8 +3264,9 @@ TEST_F(RendererSchedulerImplTest,
// With the compositor task taking 10ms, there is not enough time to run this
// 7ms timer task in the 16ms frame.
scheduler_->TimerTaskRunner()->PostTask(
- FROM_HERE, base::Bind(SlowCountingTask, &count, clock_.get(), 7,
- scheduler_->TimerTaskRunner()));
+ FROM_HERE,
+ base::Bind(SlowCountingTask, &count, clock_.get(), 7,
+ scheduler_->TimerTaskRunner()));
bool suspended = false;
for (int i = 0; i < 1000; i++) {
@@ -3300,8 +3324,9 @@ TEST_F(RendererSchedulerImplTest,
// With the compositor task taking 10ms, there is enough time to run this 6ms
// timer task in the 16ms frame.
scheduler_->TimerTaskRunner()->PostTask(
- FROM_HERE, base::Bind(SlowCountingTask, &count, clock_.get(), 6,
- scheduler_->TimerTaskRunner()));
+ FROM_HERE,
+ base::Bind(SlowCountingTask, &count, clock_.get(), 6,
+ scheduler_->TimerTaskRunner()));
for (int i = 0; i < 1000; i++) {
cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
@@ -3609,11 +3634,13 @@ TEST_F(RendererSchedulerImplTest, UnthrottledTaskRunner) {
size_t timer_count = 0;
size_t unthrottled_count = 0;
scheduler_->TimerTaskRunner()->PostTask(
- FROM_HERE, base::Bind(SlowCountingTask, &timer_count, clock_.get(), 7,
- scheduler_->TimerTaskRunner()));
+ FROM_HERE,
+ base::Bind(SlowCountingTask, &timer_count, clock_.get(), 7,
+ scheduler_->TimerTaskRunner()));
unthrottled_task_runner->PostTask(
- FROM_HERE, base::Bind(SlowCountingTask, &unthrottled_count, clock_.get(),
- 7, unthrottled_task_runner));
+ FROM_HERE,
+ base::Bind(SlowCountingTask, &unthrottled_count, clock_.get(), 7,
+ unthrottled_task_runner));
scheduler_->SuspendTimerQueue();
for (int i = 0; i < 1000; i++) {
@@ -3735,8 +3762,9 @@ TEST_F(RendererSchedulerImplTest,
mock_task_runner_->RunUntilTime(base::TimeTicks() +
base::TimeDelta::FromMilliseconds(1100));
- EXPECT_THAT(run_times, testing::ElementsAre(base::TimeTicks() +
- base::TimeDelta::FromSeconds(1)));
+ EXPECT_THAT(run_times,
+ testing::ElementsAre(base::TimeTicks() +
+ base::TimeDelta::FromSeconds(1)));
run_times.clear();
timer_task_runner_->PostDelayedTask(

Powered by Google App Engine
This is Rietveld 408576698