| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/value-serializer.h" | 5 #include "src/value-serializer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "include/v8.h" | 10 #include "include/v8.h" |
| (...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1887 |
| 1888 TEST_F(ValueSerializerTest, DecodeInvalidArrayBuffer) { | 1888 TEST_F(ValueSerializerTest, DecodeInvalidArrayBuffer) { |
| 1889 InvalidDecodeTest({0xff, 0x09, 0x42, 0xff, 0xff, 0x00}); | 1889 InvalidDecodeTest({0xff, 0x09, 0x42, 0xff, 0xff, 0x00}); |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 // An array buffer allocator that never has available memory. | 1892 // An array buffer allocator that never has available memory. |
| 1893 class OOMArrayBufferAllocator : public ArrayBuffer::Allocator { | 1893 class OOMArrayBufferAllocator : public ArrayBuffer::Allocator { |
| 1894 public: | 1894 public: |
| 1895 void* Allocate(size_t) override { return nullptr; } | 1895 void* Allocate(size_t) override { return nullptr; } |
| 1896 void* AllocateUninitialized(size_t) override { return nullptr; } | 1896 void* AllocateUninitialized(size_t) override { return nullptr; } |
| 1897 void* Reserve(size_t length) override { return nullptr; } |
| 1898 void Free(void* data, size_t length, AllocationMode mode) override {} |
| 1897 void Free(void*, size_t) override {} | 1899 void Free(void*, size_t) override {} |
| 1900 void SetProtection(void* data, size_t length, |
| 1901 Protection protection) override {} |
| 1898 }; | 1902 }; |
| 1899 | 1903 |
| 1900 TEST_F(ValueSerializerTest, DecodeArrayBufferOOM) { | 1904 TEST_F(ValueSerializerTest, DecodeArrayBufferOOM) { |
| 1901 // This test uses less of the harness, because it has to customize the | 1905 // This test uses less of the harness, because it has to customize the |
| 1902 // isolate. | 1906 // isolate. |
| 1903 OOMArrayBufferAllocator allocator; | 1907 OOMArrayBufferAllocator allocator; |
| 1904 Isolate::CreateParams params; | 1908 Isolate::CreateParams params; |
| 1905 params.array_buffer_allocator = &allocator; | 1909 params.array_buffer_allocator = &allocator; |
| 1906 Isolate* isolate = Isolate::New(params); | 1910 Isolate* isolate = Isolate::New(params); |
| 1907 { | 1911 { |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3040 InvalidDecodeTest(raw); | 3044 InvalidDecodeTest(raw); |
| 3041 } | 3045 } |
| 3042 | 3046 |
| 3043 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { | 3047 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { |
| 3044 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); | 3048 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); |
| 3045 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); | 3049 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); |
| 3046 } | 3050 } |
| 3047 | 3051 |
| 3048 } // namespace | 3052 } // namespace |
| 3049 } // namespace v8 | 3053 } // namespace v8 |
| OLD | NEW |