Index: test/cctest/cctest.h |
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h |
index 30d9d7e20d2f85aa9946e7b70afe3d025a548261..c45debe24f94f5cc6dcf229bd62d289a208bcf53 100644 |
--- a/test/cctest/cctest.h |
+++ b/test/cctest/cctest.h |
@@ -51,6 +51,26 @@ |
static void Test##Name() |
#endif |
+#define EXTENSION_LIST(V) \ |
+ V(GC_EXTENSION, "v8/gc") \ |
+ V(PRINT_EXTENSION, "v8/print") \ |
+ V(TRACE_EXTENSION, "v8/trace") |
+ |
+#define DEFINE_EXTENSION_ID(Name, Ident) Name##_ID, |
+enum CcTestExtensionIds { |
+ EXTENSION_LIST(DEFINE_EXTENSION_ID) |
+ kMaxExtensions |
+}; |
+#undef DEFINE_EXTENSION_ID |
+ |
+#define DEFINE_EXTENSION_FLAG(Name, Ident) Name = 1 << Name##_ID, |
+enum CcTestExtensionFlags { |
Sven Panne
2013/04/09 07:26:28
Using EnumSet here would be simpler and actually m
Michael Starzinger
2013/04/09 09:04:00
Done.
|
+ NO_EXTENSIONS = 0, |
+ EXTENSION_LIST(DEFINE_EXTENSION_FLAG) |
+ ALL_EXTENSIONS = (1 << kMaxExtensions) - 1 |
+}; |
+#undef DEFINE_EXTENSION_FLAG |
+ |
class CcTest { |
public: |
typedef void (TestFunction)(); |
@@ -67,6 +87,11 @@ class CcTest { |
default_isolate_ = default_isolate; |
} |
static v8::Isolate* default_isolate() { return default_isolate_; } |
+ static v8::Isolate* isolate() { return context_->GetIsolate(); } |
+ static v8::Handle<v8::Context> env() { return context_; } |
+ |
+ // Helper function to initialize the VM. |
+ static void InitializeVM(int extensions = NO_EXTENSIONS); |
Sven Panne
2013/04/09 07:26:28
Use EnumSet<CcTestExtensionFlag> (or perhaps a typ
Michael Starzinger
2013/04/09 09:04:00
Done.
|
private: |
TestFunction* callback_; |
@@ -74,9 +99,10 @@ class CcTest { |
const char* name_; |
const char* dependency_; |
bool enabled_; |
- static CcTest* last_; |
CcTest* prev_; |
+ static CcTest* last_; |
static v8::Isolate* default_isolate_; |
+ static v8::Persistent<v8::Context> context_; |
}; |
// Switches between all the Api tests using the threading support. |