| 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 1bcc70b6ee34826984115323ad6943b8b3abdefa..8f91bcfe6a1c539b470a96a0ed4e5c85e30f1ab4 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
|
| @@ -42,7 +42,7 @@ public:
|
| ScriptState* getScriptState() const { return m_scope.getScriptState(); }
|
| v8::Isolate* isolate() const { return m_scope.isolate(); }
|
|
|
| - PendingScript* pendingScript() const { return m_pendingScript.get(); }
|
| + PendingScript* getPendingScript() const { return m_pendingScript.get(); }
|
|
|
| protected:
|
| void appendData(const char* data)
|
| @@ -115,9 +115,9 @@ private:
|
| TEST_F(ScriptStreamingTest, MAYBE_CompilingStreamedScript)
|
| {
|
| // Test that we can successfully compile a streamed script.
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| appendData("function foo() {");
|
| appendPadding();
|
| @@ -132,7 +132,7 @@ TEST_F(ScriptStreamingTest, MAYBE_CompilingStreamedScript)
|
| processTasksUntilStreamingComplete();
|
| EXPECT_TRUE(client.finished());
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_TRUE(sourceCode.streamer());
|
| v8::TryCatch tryCatch(isolate());
|
| @@ -146,9 +146,9 @@ TEST_F(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
|
| // handle it gracefully.
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
| appendData("function foo() {");
|
| appendData("this is the part which will be a parse error");
|
| // V8 won't realize the parse error until it actually starts parsing the
|
| @@ -165,7 +165,7 @@ TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError)
|
| EXPECT_TRUE(client.finished());
|
|
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_TRUE(sourceCode.streamer());
|
| v8::TryCatch tryCatch(isolate());
|
| @@ -178,9 +178,9 @@ TEST_F(ScriptStreamingTest, CancellingStreaming)
|
| {
|
| // Test that the upper layers (PendingScript and up) can be ramped down
|
| // while streaming is ongoing, and ScriptStreamer handles it gracefully.
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
| appendData("function foo() {");
|
|
|
| // In general, we cannot control what the background thread is doing
|
| @@ -190,8 +190,8 @@ TEST_F(ScriptStreamingTest, CancellingStreaming)
|
| // Simulate cancelling the network load (e.g., because the user navigated
|
| // away).
|
| EXPECT_FALSE(client.finished());
|
| - pendingScript()->stopWatchingForLoad();
|
| - pendingScript()->releaseElementAndClear();
|
| + getPendingScript()->stopWatchingForLoad();
|
| + getPendingScript()->releaseElementAndClear();
|
| m_pendingScript = nullptr; // This will destroy m_resource.
|
| m_resource = nullptr;
|
|
|
| @@ -207,9 +207,9 @@ TEST_F(ScriptStreamingTest, SuppressingStreaming)
|
| // 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(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
| appendData("function foo() {");
|
| appendPadding();
|
|
|
| @@ -223,7 +223,7 @@ TEST_F(ScriptStreamingTest, SuppressingStreaming)
|
| EXPECT_TRUE(client.finished());
|
|
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| // ScriptSourceCode doesn't refer to the streamer, since we have suppressed
|
| // the streaming and resumed the non-streaming code path for script
|
| @@ -236,9 +236,9 @@ TEST_F(ScriptStreamingTest, EmptyScripts)
|
| // 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(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| // Finish the script without sending any data.
|
| finish();
|
| @@ -247,7 +247,7 @@ TEST_F(ScriptStreamingTest, EmptyScripts)
|
| EXPECT_TRUE(client.finished());
|
|
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_FALSE(sourceCode.streamer());
|
| }
|
| @@ -257,9 +257,9 @@ TEST_F(ScriptStreamingTest, SmallScripts)
|
| // Small scripts shouldn't be streamed.
|
| ScriptStreamer::setSmallScriptThresholdForTesting(100);
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| appendData("function foo() { }");
|
|
|
| @@ -270,7 +270,7 @@ TEST_F(ScriptStreamingTest, SmallScripts)
|
| EXPECT_TRUE(client.finished());
|
|
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_FALSE(sourceCode.streamer());
|
| }
|
| @@ -287,9 +287,9 @@ TEST_F(ScriptStreamingTest, MAYBE_ScriptsWithSmallFirstChunk)
|
| // chunk is small.
|
| ScriptStreamer::setSmallScriptThresholdForTesting(100);
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| // This is the first data chunk which is small.
|
| appendData("function foo() { }");
|
| @@ -302,7 +302,7 @@ TEST_F(ScriptStreamingTest, MAYBE_ScriptsWithSmallFirstChunk)
|
| processTasksUntilStreamingComplete();
|
| EXPECT_TRUE(client.finished());
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_TRUE(sourceCode.streamer());
|
| v8::TryCatch tryCatch(isolate());
|
| @@ -323,9 +323,9 @@ TEST_F(ScriptStreamingTest, MAYBE_EncodingChanges)
|
| // loading it.
|
| m_resource->setEncoding("windows-1252");
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| m_resource->setEncoding("UTF-8");
|
| // \xec\x92\x81 are the raw bytes for \uc481.
|
| @@ -336,7 +336,7 @@ TEST_F(ScriptStreamingTest, MAYBE_EncodingChanges)
|
| processTasksUntilStreamingComplete();
|
| EXPECT_TRUE(client.finished());
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_TRUE(sourceCode.streamer());
|
| v8::TryCatch tryCatch(isolate());
|
| @@ -358,9 +358,9 @@ TEST_F(ScriptStreamingTest, MAYBE_EncodingFromBOM)
|
| // will also affect encoding detection.
|
| m_resource->setEncoding("windows-1252"); // This encoding is wrong on purpose.
|
|
|
| - ScriptStreamer::startStreaming(pendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| + ScriptStreamer::startStreaming(getPendingScript(), ScriptStreamer::ParsingBlocking, m_settings.get(), m_scope.getScriptState(), m_loadingTaskRunner);
|
| TestScriptResourceClient client;
|
| - pendingScript()->watchForLoad(&client);
|
| + getPendingScript()->watchForLoad(&client);
|
|
|
| // \xef\xbb\xbf is the UTF-8 byte order mark. \xec\x92\x81 are the raw bytes
|
| // for \uc481.
|
| @@ -370,7 +370,7 @@ TEST_F(ScriptStreamingTest, MAYBE_EncodingFromBOM)
|
| processTasksUntilStreamingComplete();
|
| EXPECT_TRUE(client.finished());
|
| bool errorOccurred = false;
|
| - ScriptSourceCode sourceCode = pendingScript()->getSource(KURL(), errorOccurred);
|
| + ScriptSourceCode sourceCode = getPendingScript()->getSource(KURL(), errorOccurred);
|
| EXPECT_FALSE(errorOccurred);
|
| EXPECT_TRUE(sourceCode.streamer());
|
| v8::TryCatch tryCatch(isolate());
|
|
|