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

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 7204040: Heap profiler: add an ability to iterate over snapshot's nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.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-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
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698