| Index: Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| diff --git a/Source/bindings/core/v8/ScriptStreamerTest.cpp b/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| index b5d670b4597ea1055eeda49d336eb68c723b513b..adf5383d2ca07cfe71c58e60f0c6ab2166397d04 100644
|
| --- a/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| +++ b/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| @@ -58,7 +58,9 @@ private:
|
| PendingScript m_pendingScript;
|
| };
|
|
|
| -class ScriptStreamingTest : public testing::Test {
|
| +// The bool param for ScriptStreamingTest controls whether to make the main
|
| +// thread block and wait for parsing.
|
| +class ScriptStreamingTest : public testing::TestWithParam<bool> {
|
| public:
|
| ScriptStreamingTest()
|
| : m_scope(v8::Isolate::GetCurrent())
|
| @@ -68,6 +70,7 @@ public:
|
| , m_pendingScript(PendingScriptWrapper::create(0, m_resource)) // Takes ownership of m_resource.
|
| {
|
| m_settings->setV8ScriptStreamingEnabled(true);
|
| + m_settings->setV8ScriptStreamingBlocking(GetParam());
|
| m_resource->setLoading(true);
|
| ScriptStreamer::removeSmallScriptThresholdForTesting();
|
| }
|
| @@ -140,7 +143,7 @@ private:
|
| bool m_finished;
|
| };
|
|
|
| -TEST_F(ScriptStreamingTest, CompilingStreamedScript)
|
| +TEST_P(ScriptStreamingTest, CompilingStreamedScript)
|
| {
|
| // Test that we can successfully compile a streamed script.
|
| ScriptStreamer::startStreaming(pendingScript(), m_settings.get(), m_scope.scriptState(), PendingScript::ParsingBlocking);
|
| @@ -169,7 +172,7 @@ TEST_F(ScriptStreamingTest, CompilingStreamedScript)
|
| EXPECT_FALSE(tryCatch.HasCaught());
|
| }
|
|
|
| -TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError)
|
| +TEST_P(ScriptStreamingTest, CompilingStreamedScriptWithParseError)
|
| {
|
| // Test that scripts with parse errors are handled properly. In those cases,
|
| // the V8 side typically finished before loading finishes: make sure we
|
| @@ -202,7 +205,7 @@ TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError)
|
| EXPECT_TRUE(tryCatch.HasCaught());
|
| }
|
|
|
| -TEST_F(ScriptStreamingTest, CancellingStreaming)
|
| +TEST_P(ScriptStreamingTest, CancellingStreaming)
|
| {
|
| // Test that the upper layers (PendingScript and up) can be ramped down
|
| // while streaming is ongoing, and ScriptStreamer handles it gracefully.
|
| @@ -228,7 +231,7 @@ TEST_F(ScriptStreamingTest, CancellingStreaming)
|
| EXPECT_FALSE(client.finished());
|
| }
|
|
|
| -TEST_F(ScriptStreamingTest, SuppressingStreaming)
|
| +TEST_P(ScriptStreamingTest, SuppressingStreaming)
|
| {
|
| // If we notice during streaming that there is a code cache, streaming
|
| // is suppressed (V8 doesn't parse while the script is loading), and the
|
| @@ -256,7 +259,7 @@ TEST_F(ScriptStreamingTest, SuppressingStreaming)
|
| EXPECT_FALSE(sourceCode.streamer());
|
| }
|
|
|
| -TEST_F(ScriptStreamingTest, EmptyScripts)
|
| +TEST_P(ScriptStreamingTest, EmptyScripts)
|
| {
|
| // Empty scripts should also be streamed properly, that is, the upper layer
|
| // (ScriptResourceClient) should be notified when an empty script has been
|
| @@ -277,6 +280,8 @@ TEST_F(ScriptStreamingTest, EmptyScripts)
|
| EXPECT_FALSE(sourceCode.streamer());
|
| }
|
|
|
| +INSTANTIATE_TEST_CASE_P(ScriptStreamingInstantiation, ScriptStreamingTest, ::testing::Values(false, true));
|
| +
|
| } // namespace
|
|
|
| } // namespace blink
|
|
|