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: components/scheduler/renderer/task_cost_estimator_unittest.cc

Issue 1424053002: Adds a flag to support "Virtual Time" to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 1 month 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/task_cost_estimator_unittest.cc
diff --git a/components/scheduler/renderer/task_cost_estimator_unittest.cc b/components/scheduler/renderer/task_cost_estimator_unittest.cc
index 5f3fe8a5d470e150051487e03aeb6f29b9731c66..ec6fb1be11d5aaa96143f2156a888a1a83261ffa 100644
--- a/components/scheduler/renderer/task_cost_estimator_unittest.cc
+++ b/components/scheduler/renderer/task_cost_estimator_unittest.cc
@@ -16,23 +16,26 @@ class TaskCostEstimatorTest : public testing::Test {
TaskCostEstimatorTest() {}
~TaskCostEstimatorTest() override {}
- void SetUp() override {}
+ void SetUp() override {
+ test_time_source_.reset(new TestTimeSource(&clock_));
+ }
base::SimpleTestTickClock clock_;
+ scoped_ptr<TestTimeSource> test_time_source_;
};
class TaskCostEstimatorForTest : public TaskCostEstimator {
public:
- TaskCostEstimatorForTest(base::SimpleTestTickClock* clock,
+ TaskCostEstimatorForTest(TestTimeSource* test_time_source,
int sample_count,
double estimation_percentile)
- : TaskCostEstimator(sample_count, estimation_percentile) {
- SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock)));
- }
+ : TaskCostEstimator(test_time_source,
+ sample_count,
+ estimation_percentile) {}
};
TEST_F(TaskCostEstimatorTest, BasicEstimation) {
- TaskCostEstimatorForTest estimator(&clock_, 1, 100);
+ TaskCostEstimatorForTest estimator(test_time_source_.get(), 1, 100);
base::PendingTask task(FROM_HERE, base::Closure());
estimator.WillProcessTask(task);
@@ -44,7 +47,7 @@ TEST_F(TaskCostEstimatorTest, BasicEstimation) {
}
TEST_F(TaskCostEstimatorTest, Clear) {
- TaskCostEstimatorForTest estimator(&clock_, 1, 100);
+ TaskCostEstimatorForTest estimator(test_time_source_.get(), 1, 100);
base::PendingTask task(FROM_HERE, base::Closure());
estimator.WillProcessTask(task);
@@ -57,7 +60,7 @@ TEST_F(TaskCostEstimatorTest, Clear) {
}
TEST_F(TaskCostEstimatorTest, NestedRunLoop) {
- TaskCostEstimatorForTest estimator(&clock_, 1, 100);
+ TaskCostEstimatorForTest estimator(test_time_source_.get(), 1, 100);
base::PendingTask task(FROM_HERE, base::Closure());
// Make sure we ignore the tasks inside the nested run loop.

Powered by Google App Engine
This is Rietveld 408576698