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

Unified Diff: gin/test/file_runner.cc

Issue 69843003: Implement Mojo message codec in JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Seems to work! 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 a8d0cc213a66306f9e43b316d9eeb9f1baff3929..f80d4deae0a454d9fbdb3ddb98467d4991c4efe3 100644
--- a/gin/test/file_runner.cc
+++ b/gin/test/file_runner.cc
@@ -15,9 +15,14 @@ namespace gin {
namespace {
std::string GetExceptionInfo(const v8::TryCatch& try_catch) {
- std::string info;
- ConvertFromV8(try_catch.Message()->Get(), &info);
- return info;
+ std::string message;
+ ConvertFromV8(try_catch.Message()->Get(), &message);
+
+ std::string source_line;
+ if (ConvertFromV8(try_catch.Message()->GetSourceLine(), &source_line))
+ message += "\n" + source_line;
+
+ return message;
}
} // namespace
@@ -43,10 +48,7 @@ void FileRunnerDelegate::DidCreateContext(Runner* runner) {
GetGTestTemplate(runner->isolate()));
}
-void RunTestFromFile(const base::FilePath& path, RunnerDelegate* delegate) {
- ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName();
- std::string source;
- ASSERT_TRUE(ReadFileToString(path, &source));
+void RunTestFromString(const std::string& source, RunnerDelegate* delegate) {
gin::Runner runner(delegate, v8::Isolate::GetCurrent());
gin::Runner::Scope scope(&runner);
@@ -61,4 +63,11 @@ void RunTestFromFile(const base::FilePath& path, RunnerDelegate* delegate) {
EXPECT_EQ("PASS", result_string);
}
+void RunTestFromFile(const base::FilePath& path, RunnerDelegate* delegate) {
+ ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName();
+ std::string source;
+ ASSERT_TRUE(ReadFileToString(path, &source));
+ RunTestFromString(source, delegate);
+}
+
} // namespace gin

Powered by Google App Engine
This is Rietveld 408576698