Index: test/cctest/test-heap-profiler.cc |
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc |
index 213ed9aa90112a5e8a7c5af166aca861bcc7c038..a3e14cb74fbf6bdc6924ae7eafed12087e0c9be9 100644 |
--- a/test/cctest/test-heap-profiler.cc |
+++ b/test/cctest/test-heap-profiler.cc |
@@ -1372,4 +1372,22 @@ TEST(DocumentURLWithException) { |
reinterpret_cast<const i::HeapEntry*>(global))->name()); |
} |
+ |
+TEST(NodesIteration) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ const v8::HeapSnapshot* snapshot = |
+ v8::HeapProfiler::TakeSnapshot(v8::String::New("iteration")); |
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
+ CHECK_NE(NULL, global); |
+ // Verify that we can find this object by iteration. |
+ const int nodes_count = snapshot->GetNodesCount(); |
+ int count = 0; |
+ for (int i = 0; i < nodes_count; ++i) { |
+ if (snapshot->GetNode(i) == global) |
+ ++count; |
+ } |
+ CHECK_EQ(1, count); |
+} |
+ |
#endif // ENABLE_LOGGING_AND_PROFILING |