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