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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2686503005: Remove SerializedScriptValue::serialize and ScriptValueSerializer::serializeWTFString. (Closed)
Patch Set: Merge branch 'master' into delete-ssv Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/modules/eventsource/EventSource.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index a9b73309056902de3f12819f47739c725b990ebf..7f22058a49f9bbed93a60cdc5cc7ac7d5798099c 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -38,6 +38,7 @@
#include "SkCanvas.h"
#include "bindings/core/v8/SerializedScriptValueFactory.h"
#include "bindings/core/v8/V8Node.h"
+#include "bindings/core/v8/serialization/V8ScriptValueSerializer.h"
#include "core/clipboard/DataTransfer.h"
#include "core/css/StyleSheetContents.h"
#include "core/css/resolver/StyleResolver.h"
@@ -990,6 +991,21 @@ TEST_P(ParameterizedWebFrameTest, DispatchMessageEventWithOriginCheck) {
EXPECT_EQ(std::string::npos, content.find("Message 2."));
}
+namespace {
+
+RefPtr<SerializedScriptValue> serializeString(const StringView& message,
+ ScriptState* scriptState) {
+ // This is inefficient, but avoids duplicating serialization logic for the
+ // sake of this test.
+ NonThrowableExceptionState exceptionState;
+ ScriptState::Scope scope(scriptState);
+ V8ScriptValueSerializer serializer(scriptState);
+ return serializer.serialize(v8String(scriptState->isolate(), message),
+ nullptr, exceptionState);
+}
+
+} // namespace
+
TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) {
FrameTestHelpers::WebViewHelper webViewHelper;
webViewHelper.initializeAndLoad("about:blank");
@@ -997,10 +1013,11 @@ TEST_P(ParameterizedWebFrameTest, PostMessageThenDetach) {
LocalFrame* frame =
toLocalFrame(webViewHelper.webView()->page()->mainFrame());
NonThrowableExceptionState exceptionState;
+ RefPtr<SerializedScriptValue> message =
+ serializeString("message", ScriptState::forMainWorld(frame));
MessagePortArray messagePorts;
- frame->domWindow()->postMessage(SerializedScriptValue::serialize("message"),
- messagePorts, "*", frame->domWindow(),
- exceptionState);
+ frame->domWindow()->postMessage(message, messagePorts, "*",
+ frame->domWindow(), exceptionState);
webViewHelper.reset();
EXPECT_FALSE(exceptionState.hadException());
« no previous file with comments | « third_party/WebKit/Source/modules/eventsource/EventSource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698