Chromium Code Reviews| 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 Free(void* data, size_t length, AllocationMode mode) override {} | |
|
Eric Holk
2017/05/22 16:24:58
Same comment as before, please add Reserve and Set
| |
| 1897 void Free(void*, size_t) override {} | 1898 void Free(void*, size_t) override {} |
| 1898 }; | 1899 }; |
| 1899 | 1900 |
| 1900 TEST_F(ValueSerializerTest, DecodeArrayBufferOOM) { | 1901 TEST_F(ValueSerializerTest, DecodeArrayBufferOOM) { |
| 1901 // This test uses less of the harness, because it has to customize the | 1902 // This test uses less of the harness, because it has to customize the |
| 1902 // isolate. | 1903 // isolate. |
| 1903 OOMArrayBufferAllocator allocator; | 1904 OOMArrayBufferAllocator allocator; |
| 1904 Isolate::CreateParams params; | 1905 Isolate::CreateParams params; |
| 1905 params.array_buffer_allocator = &allocator; | 1906 params.array_buffer_allocator = &allocator; |
| 1906 Isolate* isolate = Isolate::New(params); | 1907 Isolate* isolate = Isolate::New(params); |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3040 InvalidDecodeTest(raw); | 3041 InvalidDecodeTest(raw); |
| 3041 } | 3042 } |
| 3042 | 3043 |
| 3043 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { | 3044 TEST_F(ValueSerializerTestWithWasm, DecodeWasmModuleWithInvalidDataLength) { |
| 3044 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); | 3045 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x7f, 0x00}); |
| 3045 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); | 3046 InvalidDecodeTest({0xff, 0x09, 0x3f, 0x00, 0x57, 0x79, 0x00, 0x7f}); |
| 3046 } | 3047 } |
| 3047 | 3048 |
| 3048 } // namespace | 3049 } // namespace |
| 3049 } // namespace v8 | 3050 } // namespace v8 |
| OLD | NEW |