Commit 7666126f authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Factor IOTaskRunnerTestingPlatformSupport out for reusing it

This CL factor IOTaskRunnerTestingPlatformSupport out of
modules/mediastream/media_stream_video_capturer_source_test.cc
into a helper class/file
platform/testing/io_task_runner_testing_platform_support.cc|h.

This allows it to be reusable.

This is a preparation CL for crrev.com/c/1600898.

R=haraken@chromium.org,guidou@chromium.org

BUG=787261

Change-Id: I2d5a11d4a93c19b27dc4290d025be10a9502c890
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602593Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#658370}
parent e36181d3
......@@ -21,7 +21,7 @@
#include "third_party/blink/renderer/platform/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
using ::testing::_;
......@@ -31,19 +31,6 @@ namespace blink {
namespace {
class IOTaskRunnerTestingPlatformSupport : public TestingPlatformSupport {
public:
IOTaskRunnerTestingPlatformSupport()
: io_thread_(Thread::CreateThread(
ThreadCreationParams(WebThreadType::kTestThread))) {}
scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const override {
return io_thread_->GetTaskRunner();
}
private:
std::unique_ptr<Thread> io_thread_;
};
class MockVideoCapturerSource : public media::VideoCapturerSource {
public:
MockVideoCapturerSource() {}
......
......@@ -1581,6 +1581,8 @@ jumbo_static_library("test_support") {
"testing/fuzzed_data_provider.h",
"testing/histogram_tester.cc",
"testing/histogram_tester.h",
"testing/io_task_runner_testing_platform_support.cc",
"testing/io_task_runner_testing_platform_support.h",
"testing/layer_tree_host_embedder.cc",
"testing/layer_tree_host_embedder.h",
"testing/message_loop_for_mojo.h",
......
// Copyright 2019 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 "third_party/blink/renderer/platform/testing/io_task_runner_testing_platform_support.h"
#include "base/single_thread_task_runner.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
namespace blink {
IOTaskRunnerTestingPlatformSupport::IOTaskRunnerTestingPlatformSupport()
: io_thread_(Thread::CreateThread(
ThreadCreationParams(WebThreadType::kTestThread))) {}
scoped_refptr<base::SingleThreadTaskRunner>
IOTaskRunnerTestingPlatformSupport::GetIOTaskRunner() const {
return io_thread_->GetTaskRunner();
}
} // namespace blink
// Copyright 2019 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_IO_TASK_RUNNER_TESTING_PLATFORM_SUPPORT_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_IO_TASK_RUNNER_TESTING_PLATFORM_SUPPORT_H_
#include "third_party/blink/renderer/platform/testing/testing_platform_support.h"
#include "base/memory/scoped_refptr.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace blink {
class Thread;
class IOTaskRunnerTestingPlatformSupport : public TestingPlatformSupport {
public:
IOTaskRunnerTestingPlatformSupport();
scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() const override;
private:
std::unique_ptr<Thread> io_thread_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_TESTING_IO_TASK_RUNNER_TESTING_PLATFORM_SUPPORT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment