Index: test/cctest/test-cpu-profiler.cc |
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc |
index 9a2496a72a96a77154be1003aab35b150300be8a..35f4bb4cbb5f0cd3b2a4bbe7048c997b4647433f 100644 |
--- a/test/cctest/test-cpu-profiler.cc |
+++ b/test/cctest/test-cpu-profiler.cc |
@@ -412,6 +412,26 @@ TEST(DeleteCpuProfileDifferentTokens) { |
} |
+TEST(GetProfilerWhenIsolateIsNotInitialized) { |
+ v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
+ CHECK(i::Isolate::Current()->IsDefaultIsolate()); |
+ CHECK(!i::Isolate::Current()->IsInitialized()); |
+ CHECK_EQ(NULL, isolate->GetCpuProfiler()); |
+ { |
+ v8::Isolate::Scope isolateScope(isolate); |
+ LocalContext env; |
+ v8::HandleScope scope(isolate); |
+ CHECK_NE(NULL, isolate->GetCpuProfiler()); |
+ isolate->GetCpuProfiler()->StartCpuProfiling(v8::String::New("Test")); |
+ isolate->GetCpuProfiler()->StopCpuProfiling(v8::String::New("Test")); |
+ } |
+ CHECK(i::Isolate::Current()->IsInitialized()); |
+ CHECK_NE(NULL, isolate->GetCpuProfiler()); |
+ isolate->Dispose(); |
+ CHECK_EQ(NULL, isolate->GetCpuProfiler()); |
+} |
+ |
+ |
static bool ContainsString(v8::Handle<v8::String> string, |
const Vector<v8::Handle<v8::String> >& vector) { |
for (int i = 0; i < vector.length(); i++) { |