Commit 85df08a9 authored by alexclarke's avatar alexclarke Committed by Commit bot

Wire the scheduler up in TestBlinkWebUnitTestSupport

This is needed to make the webkit_unit_tests pass when the HTML parseing
tasks are posted on the loading task queue. Required for patch
https://codereview.chromium.org/876623002

BUG=391005

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

Cr-Commit-Position: refs/heads/master@{#314002}
parent ed4b6f8b
......@@ -8,6 +8,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebScheduler.h"
#include "third_party/WebKit/public/platform/WebThread.h"
......@@ -16,7 +17,7 @@ namespace content {
class RendererScheduler;
class SingleThreadIdleTaskRunner;
class WebSchedulerImpl : public blink::WebScheduler {
class CONTENT_EXPORT WebSchedulerImpl : public blink::WebScheduler {
public:
WebSchedulerImpl(RendererScheduler* renderer_scheduler);
~WebSchedulerImpl() override;
......
......@@ -12,6 +12,8 @@
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/common/content_switches.h"
#include "content/renderer/scheduler/renderer_scheduler.h"
#include "content/renderer/scheduler/web_scheduler_impl.h"
#include "content/test/mock_webclipboard_impl.h"
#include "content/test/web_gesture_curve_mock.h"
#include "content/test/web_layer_tree_view_impl_for_testing.h"
......@@ -319,4 +321,14 @@ bool TestBlinkWebUnitTestSupport::getBlobItems(
return blob_registry_.GetBlobItems(uuid, items);
}
blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() {
// Lazily create the WebSchedulerImpl and RendererScheduler if needed.
if (!web_scheduler_) {
if (!renderer_scheduler_)
renderer_scheduler_ = RendererScheduler::Create();
web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
}
return web_scheduler_.get();
}
} // namespace content
......@@ -25,6 +25,8 @@ class WebLayerTreeView;
}
namespace content {
class RendererScheduler;
class WebSchedulerImpl;
// An implementation of blink::WebUnitTestSupport and BlinkPlatformImpl for
// tests.
......@@ -83,6 +85,7 @@ class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport,
virtual blink::WebData readFromFile(const blink::WebString& path);
virtual bool getBlobItems(const blink::WebString& uuid,
blink::WebVector<blink::WebBlobData::Item*>* items);
virtual blink::WebScheduler* scheduler();
private:
MockWebBlobRegistryImpl blob_registry_;
......@@ -93,6 +96,8 @@ class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport,
scoped_ptr<WebURLLoaderMockFactory> url_loader_factory_;
cc_blink::WebCompositorSupportImpl compositor_support_;
scoped_ptr<base::StatsTable> stats_table_;
scoped_ptr<RendererScheduler> renderer_scheduler_;
scoped_ptr<WebSchedulerImpl> web_scheduler_;
#if defined(OS_WIN) || defined(OS_MACOSX)
blink::WebThemeEngine* active_theme_engine_;
......
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