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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptValueSerializer.h" 5 #include "bindings/core/v8/ScriptValueSerializer.h"
6 6
7 #include "bindings/core/v8/ScriptController.h" 7 #include "bindings/core/v8/ScriptController.h"
8 #include "core/layout/LayoutTestHelper.h" 8 #include "core/layout/LayoutTestHelper.h"
9 #include "platform/testing/HistogramTester.h" 9 #include "platform/testing/HistogramTester.h"
10 #include "wtf/Alignment.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 class ScriptValueSerializerTest : public RenderingTest { 14 class ScriptValueSerializerTest : public RenderingTest {
14 public: 15 public:
15 FrameSettingOverrideFunction settingOverrider() const override 16 FrameSettingOverrideFunction settingOverrider() const override
16 { 17 {
17 return &overrideSettings; 18 return &overrideSettings;
18 } 19 }
19 20
(...skipping 16 matching lines...) Expand all
36 37
37 // Two JS objects: the outer object and the array. 38 // Two JS objects: the outer object and the array.
38 histogramTester.expectUniqueSample( 39 histogramTester.expectUniqueSample(
39 "Blink.ScriptValueSerializer.JSObjectCount", 2, 1); 40 "Blink.ScriptValueSerializer.JSObjectCount", 2, 1);
40 41
41 // One DOM wrapper: the blob. 42 // One DOM wrapper: the blob.
42 histogramTester.expectUniqueSample( 43 histogramTester.expectUniqueSample(
43 "Blink.ScriptValueSerializer.DOMWrapperCount", 1, 1); 44 "Blink.ScriptValueSerializer.DOMWrapperCount", 1, 1);
44 } 45 }
45 46
47 TEST_F(ScriptValueSerializerTest, Uint64Decode)
48 {
49 // Even large 64-bit integers should decode properly.
50 const uint64_t expected = 0x123456789abcdef0;
51 WTF_ALIGNED(const uint8_t, buffer[], sizeof(UChar)) = { 0xf0, 0xbd, 0xf3, 0x d5, 0x89, 0xcf, 0x95, 0x9a, 0x92, 0x00 };
52 BlobDataHandleMap blobDataHandleMap;
53 SerializedScriptValueReader reader(buffer, sizeof(buffer), nullptr, blobData HandleMap, ScriptState::forMainWorld(document().frame()));
54 uint64_t actual;
55 ASSERT_TRUE(reader.doReadUint64(&actual));
56 EXPECT_EQ(expected, actual);
57 }
58
46 } // namespace blink 59 } // namespace blink
OLDNEW
« 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