Avoid side effects related to skia error callbacks in the testing infrastructure
BUG=
Review URL: https://codereview.chromium.org/14447018
git-svn-id: http://skia.googlecode.com/svn/trunk@8867 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/Test.cpp b/tests/Test.cpp
index 5558a0b..f8f2e62 100644
--- a/tests/Test.cpp
+++ b/tests/Test.cpp
@@ -10,6 +10,7 @@
#include "SkString.h"
#include "SkTArray.h"
#include "SkTime.h"
+#include "SkError.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
@@ -92,6 +93,10 @@
} // namespace
void Test::run() {
+ // Clear the Skia error callback before running any test, to ensure that tests
+ // don't have unintended side effects when running more than one.
+ SkSetErrorCallback( NULL, NULL );
+
// Tell (likely shared) fReporter that this test has started.
fReporter->startTest(this);
@@ -108,6 +113,7 @@
fReporter->report(local.failure(i), Reporter::kFailed);
}
fReporter->endTest(this);
+
}
///////////////////////////////////////////////////////////////////////////////