Add spec for heap snapshot crash (#66).

This commit is contained in:
Cheng Zhao 2013-08-27 17:47:44 +08:00
parent fd299cb3fe
commit 018a48770a
2 changed files with 13 additions and 0 deletions

View file

@ -3,7 +3,9 @@
// found in the LICENSE file.
#include "common/api/object_life_monitor.h"
#include "v8/include/v8-profiler.h"
#include "vendor/node/src/node.h"
#include "vendor/node/src/node_internals.h"
namespace atom {
@ -44,6 +46,12 @@ v8::Handle<v8::Value> SetDestructor(const v8::Arguments& args) {
return v8::Undefined();
}
v8::Handle<v8::Value> TakeHeapSnapshot(const v8::Arguments& args) {
node::node_isolate->GetHeapProfiler()->TakeHeapSnapshot(
v8::String::New("test"));
return v8::Undefined();
}
} // namespace
void InitializeV8Util(v8::Handle<v8::Object> target) {
@ -52,6 +60,7 @@ void InitializeV8Util(v8::Handle<v8::Object> target) {
NODE_SET_METHOD(target, "setHiddenValue", SetHiddenValue);
NODE_SET_METHOD(target, "getObjectHash", GetObjectHash);
NODE_SET_METHOD(target, "setDestructor", SetDestructor);
NODE_SET_METHOD(target, "takeHeapSnapshot", TakeHeapSnapshot);
}
} // namespace api

4
spec/web/debugger.coffee Normal file
View file

@ -0,0 +1,4 @@
describe 'debugger', ->
describe 'heap snapshot', ->
it 'should not crash', ->
process.atomBinding('v8_util').takeHeapSnapshot()