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

Unified Diff: test/cctest/cctest.cc

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: Fixed presubmit errors. 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 | « test/cctest/cctest.h ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/cctest.cc
diff --git a/test/cctest/cctest.cc b/test/cctest/cctest.cc
index f1737602eafdb1d942421bad66cd2e0c6e2616f6..deed91aa57b54e5f3ba5a54acc559daf6ed1e3c1 100644
--- a/test/cctest/cctest.cc
+++ b/test/cctest/cctest.cc
@@ -57,6 +57,24 @@ CcTest::CcTest(TestFunction* callback, const char* file, const char* name,
}
+v8::Persistent<v8::Context> CcTest::context_;
+
+
+void CcTest::InitializeVM(CcTestExtensionFlags extensions) {
+ const char* extension_names[kMaxExtensions];
+ int extension_count = 0;
+#define CHECK_EXTENSION_FLAG(Name, Id) \
+ if (extensions.Contains(Name##_ID)) extension_names[extension_count++] = Id;
+ EXTENSION_LIST(CHECK_EXTENSION_FLAG)
+#undef CHECK_EXTENSION_FLAG
+ if (context_.IsEmpty()) {
+ v8::ExtensionConfiguration config(extension_count, extension_names);
+ context_ = v8::Context::New(&config);
+ }
+ context_->Enter();
+}
+
+
static void PrintTestList(CcTest* current) {
if (current == NULL) return;
PrintTestList(current->prev());
@@ -71,6 +89,7 @@ static void PrintTestList(CcTest* current) {
v8::Isolate* CcTest::default_isolate_;
+
int main(int argc, char* argv[]) {
v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
CcTest::set_default_isolate(v8::Isolate::GetCurrent());
« no previous file with comments | « test/cctest/cctest.h ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698