summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/testing/testing_platform_support_with_custom_scheduler.h
blob: 604b8a3472ce0f05cf5dd6072247b12840bba44b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2018 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.

#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TESTING_PLATFORM_SUPPORT_WITH_CUSTOM_SCHEDULER_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TESTING_PLATFORM_SUPPORT_WITH_CUSTOM_SCHEDULER_H_

#include <memory>
#include "base/macros.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"

// Test environment where you can inject your custom implementation of
// ThreadScheduler on the main thread. Multi-thread is not supported.
//
// You would probably like to use this with ScopedTestingPlatformSupport
// class template. See testing_platform_support.h for details.

namespace blink {

class TestingPlatformSupportWithCustomScheduler
    : public TestingPlatformSupport {
 public:
  // |scheduler| must be owned by the caller.
  explicit TestingPlatformSupportWithCustomScheduler(
      ThreadScheduler* scheduler);
  ~TestingPlatformSupportWithCustomScheduler() override;

 private:
  std::unique_ptr<Thread> thread_;

  DISALLOW_COPY_AND_ASSIGN(TestingPlatformSupportWithCustomScheduler);
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_TESTING_PLATFORM_SUPPORT_WITH_CUSTOM_SCHEDULER_H_