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

Unified Diff: ppapi/tests/test_case.h

Issue 8982006: Add GetLiveVars to PPB_Testing_Dev. Fix leaks it uncovered. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years 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 8ea3aef5d7c3af2cb1cd78ccfc5c51104cbdeb36..75cafdafbfee82009b0f8757cebdecbf371bdaac 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -80,8 +80,10 @@ class TestCase {
virtual pp::deprecated::ScriptableObject* CreateTestObject();
#endif
- // Initializes the testing interface.
- bool InitTestingInterface();
+ // Checks whether the testing interface is available. Returns true if it is,
+ // false otherwise. If it is not available, adds a descriptive error. This is
+ // for use by tests that require the testing interface.
+ bool CheckTestingInterface();
// Makes sure the test is run over HTTP.
bool EnsureRunningOverHTTP();
@@ -90,6 +92,11 @@ class TestCase {
// (a) filter is empty or (b) test_name and filter match exactly.
bool MatchesFilter(const std::string& test_name, const std::string& filter);
+ // Check for leaked resources and vars at the end of the test. If any exist,
+ // return a string with some information about the error. Otherwise, return
+ // an empty string.
+ std::string CheckResourcesAndVars();
+
// Pointer to the instance that owns us.
TestingInstance* instance_;
@@ -150,7 +157,10 @@ class TestCaseFactory {
#define RUN_TEST(name, test_filter) \
if (MatchesFilter(#name, test_filter)) { \
force_async_ = false; \
- instance_->LogTest(#name, Test##name()); \
+ std::string error_message = Test##name(); \
+ if (error_message.empty()) \
+ error_message = CheckResourcesAndVars(); \
+ instance_->LogTest(#name, error_message); \
}
#define RUN_TEST_WITH_REFERENCE_CHECK(name, test_filter) \

Powered by Google App Engine
This is Rietveld 408576698