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

Unified Diff: ppapi/tests/test_case.h

Issue 8477015: Make it possible to enable/disable specific ppapi tests. Migrate PostMessage tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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: ppapi/tests/test_case.h
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index 05e0d32a6b816510156462457ff8c1cfd1116d8d..ff3f1f906a069e2fb0312f7817c63d064043f0e4 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -38,8 +38,10 @@ class TestCase {
virtual bool Init();
// Override to implement the test. It will be called after the plugin is
- // first displayed.
- virtual void RunTest() = 0;
+ // first displayed, passing a string. The implementation should run all tests
+ // that contain the test_filter as a substring. E.g., passing an empty string
+ // should run all tests.
+ virtual void RunTests(const std::string& test_filter) = 0;
static std::string MakeFailureMessage(const char* file, int line,
const char* cmd);
@@ -140,24 +142,24 @@ class TestCaseFactory {
// Helper macro for calling functions implementing specific tests in the
// RunTest function. This assumes the function name is TestFoo where Foo is the
// test |name|.
-#define RUN_TEST(name) \
- do { \
+#define RUN_TEST(name, test_filter) \
+ if (std::string(#name).find(test_filter) != std::string::npos) { \
force_async_ = false; \
instance_->LogTest(#name, Test##name()); \
- } while (false)
+ }
// Like RUN_TEST above but forces functions taking callbacks to complete
// asynchronously on success or error.
-#define RUN_TEST_FORCEASYNC(name) \
- do { \
+#define RUN_TEST_FORCEASYNC(name, test_filter) \
+ if (std::string(#name"ForceAsync").find(test_filter) != std::string::npos) { \
force_async_ = true; \
instance_->LogTest(#name"ForceAsync", Test##name()); \
- } while (false)
+ }
-#define RUN_TEST_FORCEASYNC_AND_NOT(name) \
+#define RUN_TEST_FORCEASYNC_AND_NOT(name, test_filter) \
do { \
- RUN_TEST_FORCEASYNC(name); \
- RUN_TEST(name); \
+ RUN_TEST_FORCEASYNC(name, test_filter); \
+ RUN_TEST(name, test_filter); \
} while (false)

Powered by Google App Engine
This is Rietveld 408576698