| Index: third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| index 62d9c84c0d8c7f4a56924a292cd3e64a61451c27..cbfdd8c37ef92889f6fd98664bc0dbf94c6fd1b0 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| @@ -18,6 +18,7 @@
|
| #include "platform/heap/Handle.h"
|
| #include "platform/testing/UnitTestHelpers.h"
|
| #include "public/platform/Platform.h"
|
| +#include "public/platform/WebScheduler.h"
|
|
|
| #include <gtest/gtest.h>
|
| #include <v8.h>
|
| @@ -64,7 +65,8 @@
|
| class ScriptStreamingTest : public ::testing::Test {
|
| public:
|
| ScriptStreamingTest()
|
| - : m_scope(v8::Isolate::GetCurrent())
|
| + : m_loadingTaskRunner(Platform::current()->currentThread()->scheduler()->loadingTaskRunner())
|
| + , m_scope(v8::Isolate::GetCurrent())
|
| , m_settings(Settings::create())
|
| , m_resourceRequest("http://www.streaming-test.com/")
|
| , m_resource(new ScriptResource(m_resourceRequest, "UTF-8"))
|
| @@ -116,6 +118,7 @@
|
| testing::runPendingTasks();
|
| }
|
|
|
| + WebTaskRunner* m_loadingTaskRunner; // NOT OWNED
|
| V8TestingScope m_scope;
|
| OwnPtr<Settings> m_settings;
|
| // The Resource and PendingScript where we stream from. These don't really
|
| @@ -142,7 +145,7 @@
|
| TEST_F(ScriptStreamingTest, CompilingStreamedScript)
|
| {
|
| // Test that we can successfully compile a streamed script.
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
| @@ -173,7 +176,7 @@
|
| // Test that scripts with parse errors are handled properly. In those cases,
|
| // the V8 side typically finished before loading finishes: make sure we
|
| // handle it gracefully.
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
| appendData("function foo() {");
|
| @@ -205,7 +208,7 @@
|
| {
|
| // Test that the upper layers (PendingScript and up) can be ramped down
|
| // while streaming is ongoing, and ScriptStreamer handles it gracefully.
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
| appendData("function foo() {");
|
| @@ -234,7 +237,7 @@
|
| // is suppressed (V8 doesn't parse while the script is loading), and the
|
| // upper layer (ScriptResourceClient) should get a notification when the
|
| // script is loaded.
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
| appendData("function foo() {");
|
| @@ -263,7 +266,7 @@
|
| // Empty scripts should also be streamed properly, that is, the upper layer
|
| // (ScriptResourceClient) should be notified when an empty script has been
|
| // loaded.
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
| @@ -284,7 +287,7 @@
|
| // Small scripts shouldn't be streamed.
|
| ScriptStreamer::setSmallScriptThresholdForTesting(100);
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
| @@ -308,7 +311,7 @@
|
| // chunk is small.
|
| ScriptStreamer::setSmallScriptThresholdForTesting(100);
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
| @@ -338,7 +341,7 @@
|
| // loading it.
|
| m_resource->setEncoding("windows-1252");
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
| @@ -367,7 +370,7 @@
|
| // will also affect encoding detection.
|
| m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpose.
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState());
|
| + ScriptStreamer::startStreaming(pendingScript(), PendingScript::ParsingBlocking, m_settings.get(), m_scope.scriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| pendingScript().watchForLoad(&client);
|
|
|
|
|