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

Unified Diff: gin/test/file_runner.cc

Issue 76353002: Introduce a Gin class instead of using global functions to control gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
Index: gin/test/file_runner.cc
diff --git a/gin/test/file_runner.cc b/gin/test/file_runner.cc
index dd0ca66688653ddde456c1cc599c4fd0a080f2fd..ba032f38d3fe228d93cddb1689ad750a19712518 100644
--- a/gin/test/file_runner.cc
+++ b/gin/test/file_runner.cc
@@ -8,6 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "gin/converter.h"
+#include "gin/gin.h"
#include "gin/modules/module_registry.h"
#include "gin/test/gtest.h"
#include "gin/try_catch.h"
@@ -46,17 +47,22 @@ void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate) {
base::MessageLoop message_loop;
- gin::Runner runner(delegate, v8::Isolate::GetCurrent());
+ scoped_ptr<gin::Gin> instance(new gin::Gin);
+ gin::Runner runner(delegate, instance->isolate());
gin::Runner::Scope scope(&runner);
runner.Run(source);
message_loop.RunUntilIdle();
- v8::Handle<v8::Value> result = runner.context()->Global()->Get(
- StringToSymbol(runner.isolate(), "result"));
- std::string result_string;
- ASSERT_TRUE(ConvertFromV8(result, &result_string));
- EXPECT_EQ("PASS", result_string);
+ {
+ v8::Isolate::Scope isolate_scope(instance->isolate());
+ v8::HandleScope handle_scope(instance->isolate());
abarth-chromium 2013/11/19 15:49:21 We're still in the Runner's scope. I'm not sure t
jochen (gone - plz use gerrit) 2013/11/19 15:57:24 Right, I added this before I fixed Runner::Scope t
+ v8::Handle<v8::Value> result = runner.context()->Global()->Get(
+ StringToSymbol(runner.isolate(), "result"));
+ std::string result_string;
+ ASSERT_TRUE(ConvertFromV8(result, &result_string));
+ EXPECT_EQ("PASS", result_string);
+ }
}
} // namespace gin

Powered by Google App Engine
This is Rietveld 408576698