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

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

Issue 2155143002: Fix a bug that could occasionaly cause setInterval to stop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ClearExpiredWakeups tweak. Created 4 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
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 "components/scheduler/child/scheduler_helper.h" 5 #include "components/scheduler/child/scheduler_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
11 #include "cc/test/ordered_simple_task_runner.h" 11 #include "cc/test/ordered_simple_task_runner.h"
12 #include "components/scheduler/base/lazy_now.h"
12 #include "components/scheduler/base/task_queue.h" 13 #include "components/scheduler/base/task_queue.h"
13 #include "components/scheduler/base/test_time_source.h" 14 #include "components/scheduler/base/test_time_source.h"
14 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" 15 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using testing::_; 19 using testing::_;
19 using testing::AnyNumber; 20 using testing::AnyNumber;
20 using testing::Invoke; 21 using testing::Invoke;
21 using testing::Return; 22 using testing::Return;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TEST_F(SchedulerHelperTest, 173 TEST_F(SchedulerHelperTest,
173 ObserversNotNotifiedFor_ControlAfterWakeUpTaskRunner) { 174 ObserversNotNotifiedFor_ControlAfterWakeUpTaskRunner) {
174 MockTaskObserver observer; 175 MockTaskObserver observer;
175 scheduler_helper_->AddTaskObserver(&observer); 176 scheduler_helper_->AddTaskObserver(&observer);
176 177
177 scheduler_helper_->ControlAfterWakeUpTaskRunner()->PostTask( 178 scheduler_helper_->ControlAfterWakeUpTaskRunner()->PostTask(
178 FROM_HERE, base::Bind(&NopTask)); 179 FROM_HERE, base::Bind(&NopTask));
179 180
180 EXPECT_CALL(observer, WillProcessTask(_)).Times(0); 181 EXPECT_CALL(observer, WillProcessTask(_)).Times(0);
181 EXPECT_CALL(observer, DidProcessTask(_)).Times(0); 182 EXPECT_CALL(observer, DidProcessTask(_)).Times(0);
182 scheduler_helper_->ControlAfterWakeUpTaskRunner()->PumpQueue(true); 183 LazyNow lazy_now(clock_.get());
184 scheduler_helper_->ControlAfterWakeUpTaskRunner()->PumpQueue(&lazy_now, true);
183 RunUntilIdle(); 185 RunUntilIdle();
184 } 186 }
185 187
186 namespace { 188 namespace {
187 189
188 class MockObserver : public SchedulerHelper::Observer { 190 class MockObserver : public SchedulerHelper::Observer {
189 public: 191 public:
190 MOCK_METHOD1(OnUnregisterTaskQueue, 192 MOCK_METHOD1(OnUnregisterTaskQueue,
191 void(const scoped_refptr<TaskQueue>& queue)); 193 void(const scoped_refptr<TaskQueue>& queue));
192 MOCK_METHOD2(OnTriedToExecuteBlockedTask, 194 MOCK_METHOD2(OnTriedToExecuteBlockedTask,
(...skipping 24 matching lines...) Expand all
217 task_queue->SetQueueEnabled(false); 219 task_queue->SetQueueEnabled(false);
218 task_queue->PostTask(FROM_HERE, base::Bind(&NopTask)); 220 task_queue->PostTask(FROM_HERE, base::Bind(&NopTask));
219 221
220 EXPECT_CALL(observer, OnTriedToExecuteBlockedTask(_, _)).Times(1); 222 EXPECT_CALL(observer, OnTriedToExecuteBlockedTask(_, _)).Times(1);
221 RunUntilIdle(); 223 RunUntilIdle();
222 224
223 scheduler_helper_->SetObserver(nullptr); 225 scheduler_helper_->SetObserver(nullptr);
224 } 226 }
225 227
226 } // namespace scheduler 228 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/child/idle_helper.cc ('k') | components/scheduler/renderer/throttled_time_domain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698