Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1290)

Unified Diff: test/cctest/cctest.h

Issue 13483017: Unify the way cctest initalizes the VM for each test case. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/cctest.cc » ('j') | test/cctest/test-assembler-mips.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | test/cctest/cctest.cc » ('j') | test/cctest/test-assembler-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698