Avoid side effects related to skia error callbacks in the testing infrastructure
authorhumper@google.com <humper@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 25 Apr 2013 18:33:49 +0000 (18:33 +0000)
committerhumper@google.com <humper@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 25 Apr 2013 18:33:49 +0000 (18:33 +0000)
BUG=

Review URL: https://codereview.chromium.org/14447018

git-svn-id: http://skia.googlecode.com/svn/trunk@8867 2bbb7eff-a529-9590-31e7-b0007b416f81

tests/Test.cpp

index 5558a0b..f8f2e62 100644 (file)
@@ -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 {
 }  // 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 @@ void Test::run() {
       fReporter->report(local.failure(i), Reporter::kFailed);
     }
     fReporter->endTest(this);
+
 }
 
 ///////////////////////////////////////////////////////////////////////////////