Commit 3cbe3f8b authored by lukasza's avatar lukasza Committed by Commit bot

Make test_runner::WebTask an internal detail of components/test_runner.

We can expose test_runner::WebTask as blink::WebTaskRunner::Task.
Doing this means that components/test_runner/web_task.h header
no longer needs to be included outside of components/test_runner.

BUG=595089

Review URL: https://codereview.chromium.org/1805753002

Cr-Commit-Position: refs/heads/master@{#381826}
parent da9d9f67
......@@ -257,7 +257,7 @@ void MockWebSpeechRecognizer::StepTask::RunIfValid() {
return;
}
Task* task = object_->task_queue_.front();
MockWebSpeechRecognizer::Task* task = object_->task_queue_.front();
object_->task_queue_.pop_front();
task->run();
delete task;
......
......@@ -8,6 +8,7 @@
#include <vector>
#include "base/macros.h"
#include "third_party/WebKit/public/platform/WebTaskRunner.h"
namespace test_runner {
......@@ -15,15 +16,15 @@ class WebTaskList;
// WebTask represents a task which can run by WebTestDelegate::postTask() or
// WebTestDelegate::postDelayedTask().
class WebTask {
class WebTask : public blink::WebTaskRunner::Task {
public:
explicit WebTask(WebTaskList*);
virtual ~WebTask();
~WebTask() override;
// The main code of this task.
// An implementation of run() should return immediately if cancel() was
// called.
virtual void run() = 0;
void run() override = 0;
virtual void cancel() = 0;
protected:
......
......@@ -11,6 +11,7 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebTaskRunner.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h"
......@@ -82,8 +83,9 @@ class WebTestDelegate {
// The delegate takes ownership of the WebTask objects and is responsible
// for deleting them.
virtual void PostTask(WebTask* task) = 0;
virtual void PostDelayedTask(WebTask* task, long long ms) = 0;
virtual void PostTask(blink::WebTaskRunner::Task* task) = 0;
virtual void PostDelayedTask(blink::WebTaskRunner::Task* task,
long long ms) = 0;
// Register a new isolated filesystem with the given files, and return the
// new filesystem id.
......
......@@ -30,8 +30,6 @@
#include "build/build_config.h"
#include "components/plugins/renderer/plugin_placeholder.h"
#include "components/test_runner/gamepad_controller.h"
#include "components/test_runner/test_interfaces.h"
#include "components/test_runner/web_task.h"
#include "components/test_runner/web_test_interfaces.h"
#include "components/test_runner/web_test_proxy.h"
#include "components/test_runner/web_test_runner.h"
......@@ -114,18 +112,6 @@ namespace content {
namespace {
class InvokeTaskHelper : public blink::WebTaskRunner::Task {
public:
InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task)
: task_(std::move(task)) {}
// WebThread::Task implementation:
void run() override { task_->run(); }
private:
scoped_ptr<test_runner::WebTask> task_;
};
class SyncNavigationStateVisitor : public RenderViewVisitor {
public:
SyncNavigationStateVisitor() {}
......@@ -290,17 +276,15 @@ void BlinkTestRunner::PrintMessage(const std::string& message) {
Send(new ShellViewHostMsg_PrintMessage(routing_id(), message));
}
void BlinkTestRunner::PostTask(test_runner::WebTask* task) {
void BlinkTestRunner::PostTask(blink::WebTaskRunner::Task* task) {
Platform::current()->currentThread()->getWebTaskRunner()->postTask(
WebTraceLocation(__FUNCTION__, __FILE__),
new InvokeTaskHelper(make_scoped_ptr(task)));
WebTraceLocation(__FUNCTION__, __FILE__), task);
}
void BlinkTestRunner::PostDelayedTask(test_runner::WebTask* task,
void BlinkTestRunner::PostDelayedTask(blink::WebTaskRunner::Task* task,
long long ms) {
Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask(
WebTraceLocation(__FUNCTION__, __FILE__),
new InvokeTaskHelper(make_scoped_ptr(task)), ms);
WebTraceLocation(__FUNCTION__, __FILE__), task, ms);
}
WebString BlinkTestRunner::RegisterIsolatedFileSystem(
......
......@@ -71,8 +71,8 @@ class BlinkTestRunner : public RenderViewObserver,
void SetDeviceOrientationData(
const blink::WebDeviceOrientationData& data) override;
void PrintMessage(const std::string& message) override;
void PostTask(test_runner::WebTask* task) override;
void PostDelayedTask(test_runner::WebTask* task, long long ms) override;
void PostTask(blink::WebTaskRunner::Task* task) override;
void PostDelayedTask(blink::WebTaskRunner::Task* task, long long ms) override;
blink::WebString RegisterIsolatedFileSystem(
const blink::WebVector<blink::WebString>& absolute_filenames) override;
long long GetCurrentTimeInMillisecond() override;
......
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