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

Side by Side Diff: components/scheduler/child/idle_helper_unittest.cc

Issue 1250613002: scheduler: Remove task observer shenanigans (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a failing test. Created 5 years, 5 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 | « no previous file | components/scheduler/child/nestable_single_thread_task_runner.h » ('j') | 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/child/idle_helper.h" 5 #include "components/scheduler/child/idle_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "cc/test/ordered_simple_task_runner.h" 9 #include "cc/test/ordered_simple_task_runner.h"
10 #include "components/scheduler/child/scheduler_helper.h" 10 #include "components/scheduler/child/scheduler_helper.h"
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 RunUntilIdle(); 819 RunUntilIdle();
820 EXPECT_EQ(1, run_count); 820 EXPECT_EQ(1, run_count);
821 clock_->Advance(idle_task_duration); 821 clock_->Advance(idle_task_duration);
822 822
823 // Next idle period shouldn't happen until the pending task has been run. 823 // Next idle period shouldn't happen until the pending task has been run.
824 RunUntilIdle(); 824 RunUntilIdle();
825 EXPECT_EQ(1, run_count); 825 EXPECT_EQ(1, run_count);
826 826
827 // Once the pending task is run the new idle period should start. 827 // Once the pending task is run the new idle period should start.
828 clock_->Advance(pending_task_delay - idle_task_duration); 828 clock_->Advance(pending_task_delay - idle_task_duration);
829 RunUntilIdle(); 829
830 // Since the idle period tried to start before the pending task ran we have to 830 // Since the idle period tried to start before the pending task ran we have to
831 // wait for the idle helper to retry starting the long idle period. 831 // wait for the idle helper to retry starting the long idle period.
832 clock_->Advance(retry_enable_long_idle_period_delay()); 832 clock_->Advance(retry_enable_long_idle_period_delay());
833 RunUntilIdle(); 833 RunUntilIdle();
834 834
835 EXPECT_EQ(2, run_count); 835 EXPECT_EQ(2, run_count);
836 EXPECT_EQ(expected_deadline, actual_deadline); 836 EXPECT_EQ(expected_deadline, actual_deadline);
837 } 837 }
838 838
839 TEST_F(IdleHelperTest, TestLongIdlePeriodPaused) { 839 TEST_F(IdleHelperTest, TestLongIdlePeriodPaused) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 EXPECT_EQ(0, run_count); 1137 EXPECT_EQ(0, run_count);
1138 1138
1139 default_task_runner_->PostDelayedTask(FROM_HERE, base::Bind(&NullTask), 1139 default_task_runner_->PostDelayedTask(FROM_HERE, base::Bind(&NullTask),
1140 more_than_min_deadline_duration); 1140 more_than_min_deadline_duration);
1141 idle_helper_->EnableLongIdlePeriod(); 1141 idle_helper_->EnableLongIdlePeriod();
1142 RunUntilIdle(); 1142 RunUntilIdle();
1143 EXPECT_EQ(1, run_count); 1143 EXPECT_EQ(1, run_count);
1144 } 1144 }
1145 1145
1146 } // namespace scheduler 1146 } // namespace scheduler
OLDNEW
« no previous file with comments | « no previous file | components/scheduler/child/nestable_single_thread_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698