• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_TASK_SEQUENCE_MANAGER_TEST_SEQUENCE_MANAGER_FOR_TEST_H_
6 #define BASE_TASK_SEQUENCE_MANAGER_TEST_SEQUENCE_MANAGER_FOR_TEST_H_
7 
8 #include "base/single_thread_task_runner.h"
9 #include "base/task/sequence_manager/sequence_manager_impl.h"
10 #include "base/time/tick_clock.h"
11 
12 namespace base {
13 
14 class MessageLoop;
15 
16 namespace sequence_manager {
17 
18 class SequenceManagerForTest : public internal::SequenceManagerImpl {
19  public:
20   explicit SequenceManagerForTest(
21       std::unique_ptr<internal::ThreadController> thread_controller);
22 
23   ~SequenceManagerForTest() override = default;
24 
25   // Creates SequenceManagerImpl using ThreadControllerImpl constructed with
26   // the given arguments. ThreadControllerImpl is slightly overridden to skip
27   // nesting observers registration if message loop is absent.
28   static std::unique_ptr<SequenceManagerForTest> Create(
29       MessageLoop* message_loop,
30       scoped_refptr<SingleThreadTaskRunner> task_runner,
31       const TickClock* clock);
32 
33   size_t ActiveQueuesCount() const;
34   bool HasImmediateWork() const;
35   size_t PendingTasksCount() const;
36   size_t QueuesToDeleteCount() const;
37   size_t QueuesToShutdownCount();
38 
39   using internal::SequenceManagerImpl::GetNextSequenceNumber;
40   using internal::SequenceManagerImpl::WakeUpReadyDelayedQueues;
41 };
42 
43 }  // namespace sequence_manager
44 }  // namespace base
45 
46 #endif  // BASE_TASK_SEQUENCE_MANAGER_TEST_SEQUENCE_MANAGER_FOR_TEST_H_
47