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

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

Issue 16114002: Deprecate profiler methods that accept security origin (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: defined V8_DISABLE_DEPRECATIONS in test-cpu-profiler.cc and returned deleted test for deprecated API Created 7 years, 7 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 | « test/cctest/test-cpu-profiler.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 595a2069d2854b47e57a8dbf4143800e7a50f460..9b53879b2dc7037000bcea0be49c33b6294fc3e1 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1285,6 +1285,19 @@ TEST(DeleteAllHeapSnapshots) {
}
+static const v8::HeapSnapshot* FindHeapSnapshot(v8::HeapProfiler* profiler,
+ unsigned uid) {
+ int length = profiler->GetSnapshotCount();
+ for (int i = 0; i < length; i++) {
+ const v8::HeapSnapshot* snapshot = profiler->GetHeapSnapshot(i);
+ if (snapshot->GetUid() == uid) {
+ return snapshot;
+ }
+ }
+ return NULL;
+}
+
+
TEST(DeleteHeapSnapshot) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
@@ -1296,10 +1309,10 @@ TEST(DeleteHeapSnapshot) {
CHECK_NE(NULL, s1);
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
unsigned uid1 = s1->GetUid();
- CHECK_EQ(s1, heap_profiler->FindHeapSnapshot(uid1));
+ CHECK_EQ(s1, FindHeapSnapshot(heap_profiler, uid1));
const_cast<v8::HeapSnapshot*>(s1)->Delete();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, heap_profiler->FindHeapSnapshot(uid1));
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid1));
const v8::HeapSnapshot* s2 =
heap_profiler->TakeHeapSnapshot(v8_str("2"));
@@ -1307,21 +1320,21 @@ TEST(DeleteHeapSnapshot) {
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
unsigned uid2 = s2->GetUid();
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2));
- CHECK_EQ(s2, heap_profiler->FindHeapSnapshot(uid2));
+ CHECK_EQ(s2, FindHeapSnapshot(heap_profiler, uid2));
const v8::HeapSnapshot* s3 =
heap_profiler->TakeHeapSnapshot(v8_str("3"));
CHECK_NE(NULL, s3);
CHECK_EQ(2, heap_profiler->GetSnapshotCount());
unsigned uid3 = s3->GetUid();
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid3));
- CHECK_EQ(s3, heap_profiler->FindHeapSnapshot(uid3));
+ CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3));
const_cast<v8::HeapSnapshot*>(s2)->Delete();
CHECK_EQ(1, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, heap_profiler->FindHeapSnapshot(uid2));
- CHECK_EQ(s3, heap_profiler->FindHeapSnapshot(uid3));
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid2));
+ CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3));
const_cast<v8::HeapSnapshot*>(s3)->Delete();
CHECK_EQ(0, heap_profiler->GetSnapshotCount());
- CHECK_EQ(NULL, heap_profiler->FindHeapSnapshot(uid3));
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid3));
}
« no previous file with comments | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698