| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "bindings/core/v8/ScriptValueSerializer.h" | |
| 6 | |
| 7 #include "bindings/core/v8/ScriptController.h" | |
| 8 #include "core/layout/LayoutTestHelper.h" | |
| 9 #include "wtf/Alignment.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 class ScriptValueSerializerTest : public RenderingTest { | |
| 14 public: | |
| 15 FrameSettingOverrideFunction settingOverrider() const override { | |
| 16 return &overrideSettings; | |
| 17 } | |
| 18 | |
| 19 private: | |
| 20 static void overrideSettings(Settings& settings) { | |
| 21 settings.setScriptEnabled(true); | |
| 22 } | |
| 23 }; | |
| 24 | |
| 25 TEST_F(ScriptValueSerializerTest, Uint64Decode) { | |
| 26 // Even large 64-bit integers should decode properly. | |
| 27 const uint64_t expected = 0x123456789abcdef0; | |
| 28 WTF_ALIGNED(const uint8_t, buffer[], sizeof(UChar)) = { | |
| 29 0xf0, 0xbd, 0xf3, 0xd5, 0x89, 0xcf, 0x95, 0x9a, 0x92, 0x00}; | |
| 30 BlobDataHandleMap blobDataHandleMap; | |
| 31 SerializedScriptValueReader reader( | |
| 32 buffer, sizeof(buffer), nullptr, blobDataHandleMap, | |
| 33 ScriptState::forMainWorld(document().frame())); | |
| 34 uint64_t actual; | |
| 35 ASSERT_TRUE(reader.doReadUint64(&actual)); | |
| 36 EXPECT_EQ(expected, actual); | |
| 37 } | |
| 38 | |
| 39 } // namespace blink | |
| OLD | NEW |