Chromium Code Reviews| Index: test/cctest/test-api.cc |
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
| index 44270382d4e76e9f03e04d629066efd59d72b7d6..606411a1b97c258b3a7f29ce817c42e92068f00b 100644 |
| --- a/test/cctest/test-api.cc |
| +++ b/test/cctest/test-api.cc |
| @@ -28,6 +28,7 @@ |
| #include <climits> |
| #include <csignal> |
| #include <map> |
| +#include <memory> |
| #include <string> |
| #include "test/cctest/test-api.h" |
| @@ -3243,6 +3244,32 @@ TEST(PersistentValueVector) { |
| } |
| +TEST(PersistentStdContainerCompatible) { |
| + LocalContext env; |
| + v8::Isolate* isolate = env->GetIsolate(); |
| + v8::internal::GlobalHandles* global_handles = |
| + reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles(); |
| + int handle_count = global_handles->global_handles_count(); |
| + HandleScope scope(isolate); |
| + |
| + std::vector<v8::UniquePersistent<v8::Object>> vector; |
| + |
| + auto obj = v8::Object::New(isolate); |
| + v8::UniquePersistent<v8::Object> global(isolate, obj); |
| + |
| + vector.push_back(std::move(global)); |
|
jamesr
2015/03/04 18:52:37
this won't compile on all platforms that chromium
dcarney
2015/03/04 19:40:24
this test stuff is v8 only. I just wanted to chec
|
| + |
| + CHECK_EQ(1, static_cast<int>(vector.size())); |
| + CHECK(global.IsEmpty()); |
| + CHECK(obj == vector[0]); |
| + |
| + CHECK_EQ(1 + handle_count, global_handles->global_handles_count()); |
| + |
| + vector.clear(); |
| + CHECK_EQ(handle_count, global_handles->global_handles_count()); |
| +} |
| + |
| + |
| THREADED_TEST(GlobalHandleUpcast) { |
| v8::Isolate* isolate = CcTest::isolate(); |
| v8::HandleScope scope(isolate); |