Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp

Issue 2830533002: Split ScriptStreamer and ScriptStreamerImpl, preparing for unit testing (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 fc7de6b435e9d035096e0b4898d00ca994ae2191..dbf89f72b9e0315c0ae769136ab34609bf7f5d5d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp
@@ -7,12 +7,12 @@
#include <memory>
#include "bindings/core/v8/ScriptSourceCode.h"
+#include "bindings/core/v8/ScriptStreamerImpl.h"
#include "bindings/core/v8/ScriptStreamerThread.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8BindingForTesting.h"
#include "bindings/core/v8/V8ScriptRunner.h"
#include "core/dom/ClassicScript.h"
-#include "core/dom/Element.h"
#include "core/dom/PendingScript.h"
#include "core/frame/Settings.h"
#include "platform/heap/Handle.h"
@@ -39,7 +39,7 @@ class ScriptStreamingTest : public ::testing::Test {
pending_script_(PendingScript::CreateForTesting(resource_.Get())) {
resource_->SetStatus(ResourceStatus::kPending);
pending_script_ = PendingScript::CreateForTesting(resource_.Get());
- ScriptStreamer::SetSmallScriptThresholdForTesting(0);
+ ScriptStreamerImpl::SetSmallScriptThresholdForTesting(0);
}
~ScriptStreamingTest() {
@@ -110,7 +110,7 @@ class TestPendingScriptClient
TEST_F(ScriptStreamingTest, CompilingStreamedScript) {
// Test that we can successfully compile a streamed script.
V8TestingScope scope;
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -148,7 +148,7 @@ TEST_F(ScriptStreamingTest, CompilingStreamedScriptWithParseError) {
// the V8 side typically finished before loading finishes: make sure we
// handle it gracefully.
V8TestingScope scope;
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -187,7 +187,7 @@ 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.
V8TestingScope scope;
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -217,7 +217,7 @@ TEST_F(ScriptStreamingTest, SuppressingStreaming) {
// upper layer (ScriptResourceClient) should get a notification when the
// script is loaded.
V8TestingScope scope;
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -252,7 +252,7 @@ TEST_F(ScriptStreamingTest, EmptyScripts) {
// (ScriptResourceClient) should be notified when an empty script has been
// loaded.
V8TestingScope scope;
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -275,9 +275,9 @@ TEST_F(ScriptStreamingTest, EmptyScripts) {
TEST_F(ScriptStreamingTest, SmallScripts) {
// Small scripts shouldn't be streamed.
V8TestingScope scope;
- ScriptStreamer::SetSmallScriptThresholdForTesting(100);
+ ScriptStreamerImpl::SetSmallScriptThresholdForTesting(100);
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -303,9 +303,9 @@ TEST_F(ScriptStreamingTest, ScriptsWithSmallFirstChunk) {
// If a script is long enough, if should be streamed, even if the first data
// chunk is small.
V8TestingScope scope;
- ScriptStreamer::SetSmallScriptThresholdForTesting(100);
+ ScriptStreamerImpl::SetSmallScriptThresholdForTesting(100);
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -342,7 +342,7 @@ TEST_F(ScriptStreamingTest, EncodingChanges) {
V8TestingScope scope;
resource_->SetEncoding("windows-1252");
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;
@@ -379,7 +379,7 @@ TEST_F(ScriptStreamingTest, EncodingFromBOM) {
V8TestingScope scope;
resource_->SetEncoding("windows-1252"); // This encoding is wrong on purpose.
- ScriptStreamer::StartStreaming(
+ ScriptStreamerImpl::StartStreaming(
GetPendingScript(), ScriptStreamer::kParsingBlocking, settings_.get(),
scope.GetScriptState(), loading_task_runner_);
TestPendingScriptClient* client = new TestPendingScriptClient;

Powered by Google App Engine
This is Rietveld 408576698