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

Unified Diff: components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc

Issue 1156463004: Revert of scheduler: Always create a real scheduler in unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc
diff --git a/components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc b/components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc
deleted file mode 100644
index 1b2ee5b1a66bc2c8587e54c8aba36ec64a647b53..0000000000000000000000000000000000000000
--- a/components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.h"
-
-namespace scheduler {
-
-// static
-scoped_refptr<LazySchedulerMessageLoopDelegateForTests>
-LazySchedulerMessageLoopDelegateForTests::Create() {
- return make_scoped_refptr(new LazySchedulerMessageLoopDelegateForTests());
-}
-
-LazySchedulerMessageLoopDelegateForTests::
- LazySchedulerMessageLoopDelegateForTests()
- : thread_id_(base::PlatformThread::CurrentId()) {
-}
-
-LazySchedulerMessageLoopDelegateForTests::
- ~LazySchedulerMessageLoopDelegateForTests() {
-}
-
-base::MessageLoop* LazySchedulerMessageLoopDelegateForTests::EnsureMessageLoop()
- const {
- base::MessageLoop* message_loop = base::MessageLoop::current();
- DCHECK(message_loop);
- for (auto& observer : pending_observers_) {
- message_loop->AddTaskObserver(observer);
- }
- pending_observers_.clear();
- return message_loop;
-}
-
-bool LazySchedulerMessageLoopDelegateForTests::HasMessageLoop() const {
- return base::MessageLoop::current() != nullptr;
-}
-
-bool LazySchedulerMessageLoopDelegateForTests::PostDelayedTask(
- const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay) {
- return EnsureMessageLoop()->task_runner()->PostDelayedTask(from_here, task,
- delay);
-}
-
-bool LazySchedulerMessageLoopDelegateForTests::PostNonNestableDelayedTask(
- const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay) {
- return EnsureMessageLoop()->task_runner()->PostNonNestableDelayedTask(
- from_here, task, delay);
-}
-
-bool LazySchedulerMessageLoopDelegateForTests::RunsTasksOnCurrentThread()
- const {
- return thread_id_ == base::PlatformThread::CurrentId();
-}
-
-bool LazySchedulerMessageLoopDelegateForTests::IsNested() const {
- return EnsureMessageLoop()->IsNested();
-}
-
-void LazySchedulerMessageLoopDelegateForTests::AddTaskObserver(
- base::MessageLoop::TaskObserver* task_observer) {
- if (!HasMessageLoop()) {
- pending_observers_.insert(task_observer);
- return;
- }
- EnsureMessageLoop()->AddTaskObserver(task_observer);
-}
-
-void LazySchedulerMessageLoopDelegateForTests::RemoveTaskObserver(
- base::MessageLoop::TaskObserver* task_observer) {
- if (!HasMessageLoop()) {
- pending_observers_.erase(task_observer);
- return;
- }
- EnsureMessageLoop()->RemoveTaskObserver(task_observer);
-}
-
-} // namespace scheduler
« no previous file with comments | « components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.h ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698