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

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

Issue 2712783002: V8ScriptValueSerializer: Add a separate version 'envelope' for Blink format version. (Closed)
Patch Set: Merge branch 'master' into ssv-separate-version 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
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 285f31becdb12290cc1718644aaf2df3ff3221d3..3c40725261c0bb0a3b53254193ca5f07bdc5e04d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
@@ -217,7 +217,7 @@ TEST(V8ScriptValueSerializerTest, RoundTripImageData) {
EXPECT_EQ(200, newImageData->data()->data()[0]);
}
-TEST(V8ScriptValueSerializerTest, DecodeImageData) {
+TEST(V8ScriptValueSerializerTest, DecodeImageDataV9) {
// Backward compatibility with existing serialized ImageData objects must be
// maintained. Add more cases if the format changes; don't remove tests for
// old versions.
@@ -235,6 +235,21 @@ TEST(V8ScriptValueSerializerTest, DecodeImageData) {
EXPECT_EQ(200, newImageData->data()->data()[0]);
}
+TEST(V8ScriptValueSerializerTest, DecodeImageDataV16) {
+ V8TestingScope scope;
+ ScriptState* scriptState = scope.getScriptState();
+ RefPtr<SerializedScriptValue> input =
+ serializedValue({0xff, 0x10, 0xff, 0x0c, 0x23, 0x02, 0x01, 0x08, 0xc8,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
+ v8::Local<v8::Value> result =
+ V8ScriptValueDeserializer(scriptState, input).deserialize();
+ ASSERT_TRUE(V8ImageData::hasInstance(result, scope.isolate()));
+ ImageData* newImageData = V8ImageData::toImpl(result.As<v8::Object>());
+ EXPECT_EQ(IntSize(2, 1), newImageData->size());
+ EXPECT_EQ(8u, newImageData->data()->length());
+ EXPECT_EQ(200, newImageData->data()->data()[0]);
+}
+
class WebMessagePortChannelImpl final : public WebMessagePortChannel {
public:
// WebMessagePortChannel

Powered by Google App Engine
This is Rietveld 408576698