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

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

Issue 2321713002: Add a static_cast to fix a bug in ScriptValueSerializer::doReadUint64. (Closed)
Patch Set: align the buffer, because there is an assertion that demands it 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/ScriptValueSerializer.h ('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/ScriptValueSerializerTest.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializerTest.cpp
index 932dae42a6b7a89825971621a869bb1378935a28..3f464e395e28e0204f31d418ce656721174a839a 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializerTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializerTest.cpp
@@ -7,6 +7,7 @@
#include "bindings/core/v8/ScriptController.h"
#include "core/layout/LayoutTestHelper.h"
#include "platform/testing/HistogramTester.h"
+#include "wtf/Alignment.h"
namespace blink {
@@ -43,4 +44,16 @@ TEST_F(ScriptValueSerializerTest, ValueCountHistograms)
"Blink.ScriptValueSerializer.DOMWrapperCount", 1, 1);
}
+TEST_F(ScriptValueSerializerTest, Uint64Decode)
+{
+ // Even large 64-bit integers should decode properly.
+ const uint64_t expected = 0x123456789abcdef0;
+ WTF_ALIGNED(const uint8_t, buffer[], sizeof(UChar)) = { 0xf0, 0xbd, 0xf3, 0xd5, 0x89, 0xcf, 0x95, 0x9a, 0x92, 0x00 };
+ BlobDataHandleMap blobDataHandleMap;
+ SerializedScriptValueReader reader(buffer, sizeof(buffer), nullptr, blobDataHandleMap, ScriptState::forMainWorld(document().frame()));
+ uint64_t actual;
+ ASSERT_TRUE(reader.doReadUint64(&actual));
+ EXPECT_EQ(expected, actual);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698