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

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

Issue 2361253002: Support OffscreenCanvas transfer with V8-based structured clone. (Closed)
Patch Set: Merge branch 'master' into vs-offscreen-canvas Created 4 years, 3 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/bindings/core/v8/serialization/V8ScriptValueSerializer.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/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
index a522ba3bf81e1a1f90726864db59002f8a8884b2..d60a758096cdd7d523cafa761c04975119530030 100644
--- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
@@ -12,11 +12,13 @@
#include "bindings/core/v8/V8ImageBitmap.h"
#include "bindings/core/v8/V8ImageData.h"
#include "bindings/core/v8/V8MessagePort.h"
+#include "bindings/core/v8/V8OffscreenCanvas.h"
#include "bindings/core/v8/V8StringResource.h"
#include "bindings/core/v8/serialization/V8ScriptValueDeserializer.h"
#include "core/dom/MessagePort.h"
#include "core/frame/LocalFrame.h"
#include "core/html/ImageData.h"
+#include "core/offscreencanvas/OffscreenCanvas.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/graphics/StaticBitmapImage.h"
#include "public/platform/WebMessagePortChannel.h"
@@ -463,5 +465,24 @@ TEST(V8ScriptValueSerializerTest, TransferImageBitmap)
EXPECT_TRUE(imageBitmap->isNeutered());
}
+TEST(V8ScriptValueSerializerTest, TransferOffscreenCanvas)
+{
+ // More exhaustive tests in LayoutTests/. This is a sanity check.
+ ScopedEnableV8BasedStructuredClone enable;
+ V8TestingScope scope;
+ OffscreenCanvas* canvas = OffscreenCanvas::create(10, 7);
+ canvas->setAssociatedCanvasId(519);
+ v8::Local<v8::Value> wrapper = toV8(canvas, scope.getScriptState());
+ Transferables transferables;
+ transferables.offscreenCanvases.append(canvas);
+ v8::Local<v8::Value> result = roundTrip(wrapper, scope, nullptr, &transferables);
+ ASSERT_TRUE(V8OffscreenCanvas::hasInstance(result, scope.isolate()));
+ OffscreenCanvas* newCanvas = V8OffscreenCanvas::toImpl(result.As<v8::Object>());
+ EXPECT_EQ(IntSize(10, 7), newCanvas->size());
+ EXPECT_EQ(519, newCanvas->getAssociatedCanvasId());
+ EXPECT_TRUE(canvas->isNeutered());
+ EXPECT_FALSE(newCanvas->isNeutered());
+}
+
} // namespace
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698