Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Unified Diff: gin/test/gtest.cc

Issue 85223002: [Gin] Add a basic unit testing framework (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make webview_licenses.py happy 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
« no previous file with comments | « gin/test/file_runner.cc ('k') | gin/try_catch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"),
« no previous file with comments | « gin/test/file_runner.cc ('k') | gin/try_catch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698