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

Side by Side Diff: components/scheduler/renderer/idle_time_estimator_unittest.cc

Issue 1409073002: Make IdleTimeEstimator ignore nested tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Needs to be DCHECK_GE Created 5 years, 2 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
« no previous file with comments | « components/scheduler/renderer/idle_time_estimator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/scheduler/renderer/idle_time_estimator.h" 5 #include "components/scheduler/renderer/idle_time_estimator.h"
6 6
7 #include "base/test/simple_test_tick_clock.h" 7 #include "base/test/simple_test_tick_clock.h"
8 #include "cc/test/ordered_simple_task_runner.h" 8 #include "cc/test/ordered_simple_task_runner.h"
9 #include "components/scheduler/base/task_queue_manager.h" 9 #include "components/scheduler/base/task_queue_manager.h"
10 #include "components/scheduler/base/test_time_source.h" 10 #include "components/scheduler/base/test_time_source.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 TEST_F(IdleTimeEstimatorTest, Estimation_MultipleTasks) { 138 TEST_F(IdleTimeEstimatorTest, Estimation_MultipleTasks) {
139 SimulateFrameWithTwoCompositorTasks(1, 4); 139 SimulateFrameWithTwoCompositorTasks(1, 4);
140 SimulateFrameWithTwoCompositorTasks(1, 4); 140 SimulateFrameWithTwoCompositorTasks(1, 4);
141 141
142 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11), 142 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11),
143 estimator_->GetExpectedIdleDuration(frame_length_)); 143 estimator_->GetExpectedIdleDuration(frame_length_));
144 } 144 }
145 145
146 TEST_F(IdleTimeEstimatorTest, IgnoresNestedTasks) {
147 SimulateFrameWithOneCompositorTask(5);
148 SimulateFrameWithOneCompositorTask(5);
149
150 base::PendingTask task(FROM_HERE, base::Closure());
151 estimator_->WillProcessTask(task);
152 SimulateFrameWithTwoCompositorTasks(4, 4);
153 SimulateFrameWithTwoCompositorTasks(4, 4);
154 SimulateFrameWithTwoCompositorTasks(4, 4);
155 SimulateFrameWithTwoCompositorTasks(4, 4);
156 estimator_->DidCommitFrameToCompositor();
157 estimator_->DidProcessTask(task);
158
159 EXPECT_EQ(base::TimeDelta::FromMilliseconds(11),
160 estimator_->GetExpectedIdleDuration(frame_length_));
161 }
162
163
146 } // namespace scheduler 164 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/idle_time_estimator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698