Implement TaskQueueBase interface by SingleThreadedTaskQueueForTesting

that allows to use SingleThreadedTaskQueueForTesting as regular TaskQueue.
which allows components that currently depend on SingleThreadedTaskQueueForTesting
to depend on TaskQueueBase interface instead.
Those updates can be done one-by-one and in the end would allow to stop
using SingleThreadedTaskQueueForTesting in favor of other TaskQueue implementations.

Bug: webrtc:10933
Change-Id: I3e642c88c968012588b9d9c09918340f37bbedbd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154352
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Reviewed-by: Yves Gerey <yvesg@google.com>
Reviewed-by: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29307}
This commit is contained in:
Danil Chapovalov
2019-09-25 17:21:52 +02:00
committed by Commit Bot
parent ad10222289
commit 71037a8e99
4 changed files with 78 additions and 38 deletions

View File

@ -14,6 +14,7 @@
#include <memory>
#include <vector>
#include "api/task_queue/task_queue_test.h"
#include "rtc_base/event.h"
#include "test/gtest.h"
@ -352,6 +353,22 @@ TEST(DEPRECATED_SingleThreadedTaskQueueForTestingTest,
EXPECT_LT(counter, tasks);
}
class SingleThreadedTaskQueueForTestingFactory : public TaskQueueFactory {
public:
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue(
absl::string_view /* name */,
Priority /*priority*/) const override {
return std::unique_ptr<TaskQueueBase, TaskQueueDeleter>(
new DEPRECATED_SingleThreadedTaskQueueForTesting("noname"));
}
};
INSTANTIATE_TEST_SUITE_P(
DeprecatedSingleThreadedTaskQueueForTesting,
TaskQueueTest,
::testing::Values(
std::make_unique<SingleThreadedTaskQueueForTestingFactory>));
} // namespace
} // namespace test
} // namespace webrtc