Chromium Code Reviews| Index: test/cctest/test-api.cc |
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
| index 11d9fcaba8505908ba6c96c600f929ad540b656a..2e63124ba4f82aad67236637808cf402d2585038 100644 |
| --- a/test/cctest/test-api.cc |
| +++ b/test/cctest/test-api.cc |
| @@ -2486,6 +2486,35 @@ THREADED_TEST(GlobalHandle) { |
| } |
| +THREADED_TEST(ResettingGlobalHandle) { |
| + v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| + v8::internal::GlobalHandles* global_handles = NULL; |
| + int initial_handle_count = 0; |
| + v8::Persistent<String> global; |
| + { |
| + v8::HandleScope scope(isolate); |
| + Local<String> str = v8_str("str"); |
| + |
|
dcarney
2013/05/06 14:10:59
can drop the empty lines. v8 people seem not to be
marja
2013/05/06 14:15:21
Done.
|
| + global_handles = |
| + reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| + initial_handle_count = global_handles->NumberOfGlobalHandles(); |
| + |
| + global = v8::Persistent<String>::New(isolate, str); |
| + } |
| + CHECK_EQ(global->Length(), 3); |
| + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); |
| + { |
| + v8::HandleScope scope(isolate); |
| + Local<String> str = v8_str("longer"); |
| + global.Reset(isolate, str); |
| + } |
| + CHECK_EQ(global->Length(), 6); |
| + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); |
| + global.Dispose(isolate); |
| + CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); |
| +} |
| + |
| + |
| THREADED_TEST(LocalHandle) { |
| v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| v8::Local<String> local = v8::Local<String>::New(v8_str("str")); |