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

Unified Diff: test/cctest/test-api.cc

Side-by-side diff isn't available for this file because of its large size.
Issue 2498413002: Initialize internal fields in Factory::NewJSTypedArray and NewJSDataView. (Closed)
Patch Set: unit tests Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « src/factory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 354db4344f98c403665a0bd0a4e6b3c1ff69d4ee..623831fdd8507f9619dda6f1b3777772abf184a1 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -26150,3 +26150,31 @@ THREADED_TEST(MutableProtoGlobal) {
CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 0))
.FromJust());
}
+
+TEST(InternalFieldsOnTypedArray) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Context> context = env.local();
+ Context::Scope context_scope(context);
+ v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1);
+ v8::Local<v8::Uint8Array> array = v8::Uint8Array::New(buffer, 0, 1);
+ for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) {
+ CHECK_EQ(static_cast<void*>(nullptr),
+ array->GetAlignedPointerFromInternalField(i));
+ }
+}
+
+TEST(InternalFieldsOnDataView) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Context> context = env.local();
+ Context::Scope context_scope(context);
+ v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1);
+ v8::Local<v8::DataView> array = v8::DataView::New(buffer, 0, 1);
+ for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) {
+ CHECK_EQ(static_cast<void*>(nullptr),
+ array->GetAlignedPointerFromInternalField(i));
+ }
+}
« no previous file with comments | « src/factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698