| Index: third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
|
| index b9668ec507af2e7981912ea7d232d2d4f7562221..09e5579b06e2a871feb4d81eb80934ac4f0dfe56 100644
|
| --- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
|
| @@ -10,6 +10,7 @@
|
| #include "core/dom/ScriptLoader.h"
|
| #include "platform/heap/Handle.h"
|
| #include "platform/scheduler/CancellableTaskFactory.h"
|
| +#include "platform/testing/TestingPlatformSupport.h"
|
| #include "public/platform/Platform.h"
|
| #include "public/platform/WebViewScheduler.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| @@ -95,7 +96,7 @@ public:
|
| Deque<OwnPtr<WebTaskRunner::Task>>* m_tasks; // NOT OWNED
|
| };
|
|
|
| -class MockPlatform : public Platform, public WebScheduler {
|
| +class MockPlatform : public TestingPlatformSupport, public WebScheduler {
|
| public:
|
| MockPlatform()
|
| : m_mockWebThread(this)
|
| @@ -103,17 +104,6 @@ public:
|
| {
|
| }
|
|
|
| - void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override
|
| - {
|
| - RELEASE_ASSERT_NOT_REACHED();
|
| - }
|
| -
|
| - const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override
|
| - {
|
| - static const unsigned char tracingIsDisabled = 0;
|
| - return &tracingIsDisabled;
|
| - }
|
| -
|
| WebThread* currentThread() override { return &m_mockWebThread; }
|
|
|
| void runSingleTask()
|
| @@ -163,16 +153,14 @@ private:
|
|
|
| class ScriptRunnerTest : public testing::Test {
|
| public:
|
| - void SetUp() override
|
| + ScriptRunnerTest()
|
| + : m_document(Document::create())
|
| + , m_element(m_document->createElement("foo", ASSERT_NO_EXCEPTION))
|
| {
|
| - m_document = Document::create();
|
| - m_element = m_document->createElement("foo", ASSERT_NO_EXCEPTION);
|
| -
|
| - m_oldPlatform = Platform::current();
|
| -
|
| - // Force Platform::initialize to create a new one pointing at MockPlatform.
|
| - Platform::initialize(&m_platform);
|
| + }
|
|
|
| + void SetUp() override
|
| + {
|
| // We have to create ScriptRunner after initializing platform, because we need
|
| // Platform::current()->currentThread()->scheduler()->loadingTaskRunner()
|
| // to be initialized before creating ScriptRunner to save it in constructor.
|
| @@ -182,15 +170,13 @@ public:
|
| void TearDown() override
|
| {
|
| m_scriptRunner.release();
|
| - Platform::initialize(m_oldPlatform);
|
| }
|
|
|
| RefPtrWillBePersistent<Document> m_document;
|
| RefPtrWillBePersistent<Element> m_element;
|
| + MockPlatform m_platform;
|
| OwnPtrWillBePersistent<ScriptRunner> m_scriptRunner;
|
| WTF::Vector<int> m_order;
|
| - MockPlatform m_platform;
|
| - Platform* m_oldPlatform; // NOT OWNED
|
| };
|
|
|
| TEST_F(ScriptRunnerTest, QueueSingleScript_Async)
|
|
|