summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/TestsController.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Tools/TestWebKitAPI/TestsController.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Tools/TestWebKitAPI/TestsController.cpp')
-rw-r--r--Tools/TestWebKitAPI/TestsController.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/Tools/TestWebKitAPI/TestsController.cpp b/Tools/TestWebKitAPI/TestsController.cpp
index 29dcc714e..913305d7b 100644
--- a/Tools/TestWebKitAPI/TestsController.cpp
+++ b/Tools/TestWebKitAPI/TestsController.cpp
@@ -30,9 +30,33 @@
namespace TestWebKitAPI {
-TestsController& TestsController::shared()
+class Printer : public ::testing::EmptyTestEventListener {
+ virtual void OnTestPartResult(const ::testing::TestPartResult& test_part_result)
+ {
+ if (!test_part_result.failed())
+ return;
+
+ std::stringstream stream;
+ stream << "\n" << test_part_result.file_name() << ":" << test_part_result.line_number() << "\n" << test_part_result.summary() << "\n\n";
+ failures += stream.str();
+ }
+
+ virtual void OnTestEnd(const ::testing::TestInfo& test_info)
+ {
+ if (test_info.result()->Passed())
+ std::cout << "**PASS** " << test_info.test_case_name() << "." << test_info.name() << "\n";
+ else
+ std::cout << "**FAIL** " << test_info.test_case_name() << "." << test_info.name() << "\n" << failures;
+
+ failures = std::string();
+ }
+
+ std::string failures;
+};
+
+TestsController& TestsController::singleton()
{
- static TestsController& shared = *new TestsController;
+ static NeverDestroyed<TestsController> shared;
return shared;
}
@@ -48,6 +72,11 @@ TestsController::TestsController()
bool TestsController::run(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
+
+ ::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners();
+ delete listeners.Release(listeners.default_result_printer());
+ listeners.Append(new Printer);
+
return !RUN_ALL_TESTS();
}