OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests for heap profiler | 3 // Tests for heap profiler |
4 | 4 |
5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 #include "heap-profiler.h" | 8 #include "heap-profiler.h" |
9 #include "snapshot.h" | 9 #include "snapshot.h" |
10 #include "string-stream.h" | 10 #include "string-stream.h" |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 v8::HandleScope scope; | 1171 v8::HandleScope scope; |
1172 LocalContext env; | 1172 LocalContext env; |
1173 const v8::HeapSnapshot* snapshot = | 1173 const v8::HeapSnapshot* snapshot = |
1174 v8::HeapProfiler::TakeSnapshot(v8::String::New("abort")); | 1174 v8::HeapProfiler::TakeSnapshot(v8::String::New("abort")); |
1175 TestJSONStream stream(5); | 1175 TestJSONStream stream(5); |
1176 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); | 1176 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); |
1177 CHECK_GT(stream.size(), 0); | 1177 CHECK_GT(stream.size(), 0); |
1178 CHECK_EQ(0, stream.eos_signaled()); | 1178 CHECK_EQ(0, stream.eos_signaled()); |
1179 } | 1179 } |
1180 | 1180 |
| 1181 |
| 1182 // Must not crash in debug mode. |
| 1183 TEST(AggregatedHeapSnapshotJSONSerialization) { |
| 1184 v8::HandleScope scope; |
| 1185 LocalContext env; |
| 1186 |
| 1187 const v8::HeapSnapshot* snapshot = |
| 1188 v8::HeapProfiler::TakeSnapshot( |
| 1189 v8::String::New("agg"), v8::HeapSnapshot::kAggregated); |
| 1190 TestJSONStream stream; |
| 1191 snapshot->Serialize(&stream, v8::HeapSnapshot::kJSON); |
| 1192 CHECK_GT(stream.size(), 0); |
| 1193 CHECK_EQ(1, stream.eos_signaled()); |
| 1194 } |
| 1195 |
1181 #endif // ENABLE_LOGGING_AND_PROFILING | 1196 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |