Chromium Code Reviews| Index: test/cctest/test-heap-profiler.cc |
| diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc |
| index efb80453e02117724dd5a33b5c07d1fdb6eed7b9..68d39efe1d2cafdcbae2ee4e457e5beabbd6e200 100644 |
| --- a/test/cctest/test-heap-profiler.cc |
| +++ b/test/cctest/test-heap-profiler.cc |
| @@ -2383,3 +2383,36 @@ TEST(ArrayBufferAndArrayBufferView) { |
| GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); |
| CHECK_NE(NULL, first_view); |
| } |
| + |
| + |
| +TEST(BoxObject) { |
| + v8::Isolate* isolate = CcTest::isolate(); |
| + v8::HandleScope scope(isolate); |
| + v8::Local<v8::ObjectTemplate> global_template = |
| + v8::ObjectTemplate::New(isolate); |
| + global_template->SetInternalFieldCount(1); |
| + LocalContext env(NULL, global_template); |
| + v8::Handle<v8::Object> global_proxy = env->Global(); |
| + v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
| + CHECK_EQ(1, global->InternalFieldCount()); |
|
yurys
2014/02/03 09:26:27
Do you really need this check in this test?
alph
2014/02/04 09:41:54
Done.
|
| + |
| + i::Factory* factory = CcTest::i_isolate()->factory(); |
| + i::Handle<i::String> string = |
| + factory->NewStringFromAscii(i::CStrVector("string")); |
| + i::Handle<i::Object> box = factory->NewBox(string); |
| + global->Set(0, v8::ToApiHandle<v8::Object>(box)); |
| + |
| + v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); |
| + const v8::HeapSnapshot* snapshot = |
| + heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
| + CHECK(ValidateSnapshot(snapshot)); |
| + const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
| + const v8::HeapGraphNode* box_node = |
| + GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); |
| + CHECK_NE(NULL, box_node); |
| + v8::String::Utf8Value box_node_name(box_node->GetName()); |
| + CHECK_EQ("system / Box", *box_node_name); |
| + const v8::HeapGraphNode* box_value = |
| + GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); |
| + CHECK_NE(NULL, box_value); |
| +} |