Index: gin/test/gtest.cc |
diff --git a/gin/test/gtest.cc b/gin/test/gtest.cc |
index 422d3ec007ce465f1a0828ddc2b9f9baa82c8bd0..254c735bba34262e2acd075badd02d3ae413085c 100644 |
--- a/gin/test/gtest.cc |
+++ b/gin/test/gtest.cc |
@@ -18,6 +18,16 @@ namespace gin { |
namespace { |
+void Fail(const v8::FunctionCallbackInfo<v8::Value>& info) { |
+ Arguments args(info); |
+ |
+ std::string description; |
+ if (!args.GetNext(&description)) |
+ return args.ThrowError(); |
+ |
+ FAIL() << description; |
+} |
+ |
void ExpectTrue(bool condition, const std::string& description) { |
EXPECT_TRUE(condition) << description; |
} |
@@ -48,6 +58,8 @@ v8::Local<v8::ObjectTemplate> GTest::GetTemplate(v8::Isolate* isolate) { |
data->GetObjectTemplate(&g_wrapper_info); |
if (templ.IsEmpty()) { |
templ = v8::ObjectTemplate::New(); |
+ templ->Set(StringToSymbol(isolate, "fail"), |
+ v8::FunctionTemplate::New(Fail)); |
templ->Set(StringToSymbol(isolate, "expectTrue"), |
CreateFunctionTempate(isolate, base::Bind(ExpectTrue))); |
templ->Set(StringToSymbol(isolate, "expectFalse"), |