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

Unified Diff: Source/web/tests/WebUnitTests.h

Issue 412683003: Switch webkit_unit_tests to use the new test launcher. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix gyp for non-component Created 6 years, 5 months 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 | « Source/web/tests/RunAllTests.cpp ('k') | Source/web/tests/WebUnitTests.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebUnitTests.h
diff --git a/Source/web/tests/WebUnitTests.h b/Source/web/tests/WebUnitTests.h
index c284145443a1154f5675c2065b0361d48f7300c2..d85172feb1c7568e167547cd5cf58d6732354534 100644
--- a/Source/web/tests/WebUnitTests.h
+++ b/Source/web/tests/WebUnitTests.h
@@ -35,22 +35,23 @@
namespace blink {
-// In chromium multi-dll build, webkit unittest code are compiled in
-// blink_web.dll. This means the test suite object needs to be initialized
-// inside Blink.
+// In a chromium multi-dll build, blink unittest code is compiled into
+// blink_web.dll, since some of the tests cover unexported methods.
//
-// However, the webkit unittest code needs to also initialize/teardown.
-// This leads to the API here, which has explicit managment of the TestSuite
-// lifetime.
-
-// Initialize the global testSuite object inside blink_web.dll
-BLINK_EXPORT void InitTestSuite(int argc, char** argv);
-
-// Runs all tests found inside blink_web.dll
-BLINK_EXPORT int RunAllUnitTests();
-
-// Deletes the global testSuite object inside blink_web.dll
-BLINK_EXPORT void DeleteTestSuite();
+// While gtest does support running tests in libraries, the chromium gtest is
+// not built with shared library support. As a result, if the test runner tries
+// to instantiate the test suite outside of blink_web.dll, it won't correctly
+// register the tests. In order to get around that, blink_web.dll exports this
+// helper function to instantiate and run the test suite in the right module.
+//
+// Unfortunately, to make things more complicated, blink tests require some test
+// support initialization in the content layer. Since the content layer depends
+// on blink_web.dll, runWebTests() can't initialize it directly since that
+// introduces a dependency cycle.
+//
+// To get around that, runWebTests() allows the caller to supply hooks to
+// execute code before and after running tests.
+BLINK_EXPORT int runWebTests(int argc, char** argv, void (*preTestHook)(void), void (*postTestHook)(void));
} // namespace blink
« no previous file with comments | « Source/web/tests/RunAllTests.cpp ('k') | Source/web/tests/WebUnitTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698