Index: test/unittests/run-all-unittests.cc |
diff --git a/test/unittests/run-all-unittests.cc b/test/unittests/run-all-unittests.cc |
index 08d265624bf84eff360c99e4d88cb8c5ef9410ba..9c67cfaba59e920c7a9ce4b1d433999392ba14c2 100644 |
--- a/test/unittests/run-all-unittests.cc |
+++ b/test/unittests/run-all-unittests.cc |
@@ -13,6 +13,16 @@ |
namespace { |
+class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
+ public: |
+ virtual void* Allocate(size_t length) { |
+ void* data = AllocateUninitialized(length); |
+ return data == NULL ? data : memset(data, 0, length); |
+ } |
+ virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
+ virtual void Free(void* data, size_t) { free(data); } |
+}; |
+ |
class DefaultPlatformEnvironment final : public ::testing::Environment { |
public: |
DefaultPlatformEnvironment() : platform_(NULL) {} |
@@ -23,6 +33,7 @@ class DefaultPlatformEnvironment final : public ::testing::Environment { |
platform_ = v8::platform::CreateDefaultPlatform(); |
ASSERT_TRUE(platform_ != NULL); |
v8::V8::InitializePlatform(platform_); |
+ v8::V8::SetArrayBufferAllocator(&array_buffer_allocator_); |
ASSERT_TRUE(v8::V8::Initialize()); |
} |
@@ -36,6 +47,7 @@ class DefaultPlatformEnvironment final : public ::testing::Environment { |
private: |
v8::Platform* platform_; |
+ ArrayBufferAllocator array_buffer_allocator_; |
}; |
} // namespace |