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

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

Issue 5537001: New Heap Profiler: add API method for finding a graph node by id. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 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:
View side-by-side diff with in-line comments
Download patch
« src/profile-generator.cc ('K') | « src/profile-generator.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 95314d74a4157c40904447df60eab5b18bc9834b..ac4afb2517c7b4bfd0e18d327f35019a155e3838 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1193,4 +1193,22 @@ TEST(AggregatedHeapSnapshotJSONSerialization) {
CHECK_EQ(1, stream.eos_signaled());
}
+
+TEST(HeapSnapshotGetNodeById) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ const v8::HeapSnapshot* snapshot =
+ v8::HeapProfiler::TakeSnapshot(v8::String::New("id"));
+ const v8::HeapGraphNode* root = snapshot->GetRoot();
+ CHECK_EQ(root, snapshot->GetNodeById(root->GetId()));
+ for (int i = 0, count = root->GetChildrenCount(); i < count; ++i) {
+ const v8::HeapGraphEdge* prop = root->GetChild(i);
+ CHECK_EQ(
+ prop->GetToNode(), snapshot->GetNodeById(prop->GetToNode()->GetId()));
+ }
+ // Check a big id, which should not exist yet.
+ CHECK_EQ(NULL, snapshot->GetNodeById(0x1000000UL));
+}
+
#endif // ENABLE_LOGGING_AND_PROFILING
« src/profile-generator.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698