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

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

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc 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/renderer/renderer_scheduler_impl.h" 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/run_loop.h"
12 #include "base/test/simple_test_tick_clock.h" 13 #include "base/test/simple_test_tick_clock.h"
13 #include "cc/output/begin_frame_args.h" 14 #include "cc/output/begin_frame_args.h"
14 #include "cc/test/ordered_simple_task_runner.h" 15 #include "cc/test/ordered_simple_task_runner.h"
15 #include "components/scheduler/base/test_time_source.h" 16 #include "components/scheduler/base/test_time_source.h"
16 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h" 17 #include "components/scheduler/child/scheduler_tqm_delegate_for_test.h"
17 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h" 18 #include "components/scheduler/child/scheduler_tqm_delegate_impl.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace scheduler { 22 namespace scheduler {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 267
267 void TearDown() override { 268 void TearDown() override {
268 DCHECK(!mock_task_runner_.get() || !message_loop_.get()); 269 DCHECK(!mock_task_runner_.get() || !message_loop_.get());
269 scheduler_->Shutdown(); 270 scheduler_->Shutdown();
270 if (mock_task_runner_.get()) { 271 if (mock_task_runner_.get()) {
271 // Check that all tests stop posting tasks. 272 // Check that all tests stop posting tasks.
272 mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true); 273 mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
273 while (mock_task_runner_->RunUntilIdle()) { 274 while (mock_task_runner_->RunUntilIdle()) {
274 } 275 }
275 } else { 276 } else {
276 message_loop_->RunUntilIdle(); 277 base::RunLoop().RunUntilIdle();
277 } 278 }
278 scheduler_.reset(); 279 scheduler_.reset();
279 } 280 }
280 281
281 void RunUntilIdle() { 282 void RunUntilIdle() {
282 // Only one of mock_task_runner_ or message_loop_ should be set. 283 // Only one of mock_task_runner_ or message_loop_ should be set.
283 DCHECK(!mock_task_runner_.get() || !message_loop_.get()); 284 DCHECK(!mock_task_runner_.get() || !message_loop_.get());
284 if (mock_task_runner_.get()) 285 if (mock_task_runner_.get())
285 mock_task_runner_->RunUntilIdle(); 286 mock_task_runner_->RunUntilIdle();
286 else 287 else
287 message_loop_->RunUntilIdle(); 288 base::RunLoop().RunUntilIdle();
288 } 289 }
289 290
290 void DoMainFrame() { 291 void DoMainFrame() {
291 cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create( 292 cc::BeginFrameArgs begin_frame_args = cc::BeginFrameArgs::Create(
292 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(), 293 BEGINFRAME_FROM_HERE, clock_->NowTicks(), base::TimeTicks(),
293 base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL); 294 base::TimeDelta::FromMilliseconds(16), cc::BeginFrameArgs::NORMAL);
294 begin_frame_args.on_critical_path = false; 295 begin_frame_args.on_critical_path = false;
295 scheduler_->WillBeginFrame(begin_frame_args); 296 scheduler_->WillBeginFrame(begin_frame_args);
296 scheduler_->DidCommitFrameToCompositor(); 297 scheduler_->DidCommitFrameToCompositor();
297 } 298 }
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 std::pair<SingleThreadIdleTaskRunner::IdleTask, bool>>* tasks) { 1837 std::pair<SingleThreadIdleTaskRunner::IdleTask, bool>>* tasks) {
1837 base::MessageLoop::ScopedNestableTaskAllower allow(message_loop_.get()); 1838 base::MessageLoop::ScopedNestableTaskAllower allow(message_loop_.get());
1838 for (std::pair<SingleThreadIdleTaskRunner::IdleTask, bool>& pair : *tasks) { 1839 for (std::pair<SingleThreadIdleTaskRunner::IdleTask, bool>& pair : *tasks) {
1839 if (pair.second) { 1840 if (pair.second) {
1840 idle_task_runner_->PostIdleTask(FROM_HERE, pair.first); 1841 idle_task_runner_->PostIdleTask(FROM_HERE, pair.first);
1841 } else { 1842 } else {
1842 idle_task_runner_->PostNonNestableIdleTask(FROM_HERE, pair.first); 1843 idle_task_runner_->PostNonNestableIdleTask(FROM_HERE, pair.first);
1843 } 1844 }
1844 } 1845 }
1845 EnableIdleTasks(); 1846 EnableIdleTasks();
1846 message_loop_->RunUntilIdle(); 1847 base::RunLoop().RunUntilIdle();
1847 } 1848 }
1848 1849
1849 private: 1850 private:
1850 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImplWithMessageLoopTest); 1851 DISALLOW_COPY_AND_ASSIGN(RendererSchedulerImplWithMessageLoopTest);
1851 }; 1852 };
1852 1853
1853 TEST_F(RendererSchedulerImplWithMessageLoopTest, 1854 TEST_F(RendererSchedulerImplWithMessageLoopTest,
1854 NonNestableIdleTaskDoesntExecuteInNestedLoop) { 1855 NonNestableIdleTaskDoesntExecuteInNestedLoop) {
1855 std::vector<std::string> order; 1856 std::vector<std::string> order;
1856 idle_task_runner_->PostIdleTask( 1857 idle_task_runner_->PostIdleTask(
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 base::Bind(&RendererSchedulerImplTest::SimulatedCompositorTaskPending, 3407 base::Bind(&RendererSchedulerImplTest::SimulatedCompositorTaskPending,
3407 base::Unretained(this))); 3408 base::Unretained(this)));
3408 EXPECT_EQ(UseCase::SYNCHRONIZED_GESTURE, CurrentUseCase()) << "i = " << i; 3409 EXPECT_EQ(UseCase::SYNCHRONIZED_GESTURE, CurrentUseCase()) << "i = " << i;
3409 } 3410 }
3410 3411
3411 EXPECT_EQ(0u, timer_count); 3412 EXPECT_EQ(0u, timer_count);
3412 EXPECT_EQ(500u, unthrottled_count); 3413 EXPECT_EQ(500u, unthrottled_count);
3413 } 3414 }
3414 3415
3415 } // namespace scheduler 3416 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/child/idle_helper_unittest.cc ('k') | components/search_provider_logos/logo_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698