Convert some unit tests from running on GL contexts to running on all contexts
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1873313002

Review URL: https://codereview.chromium.org/1873313002
diff --git a/dm/DM.cpp b/dm/DM.cpp
index fd06bc0..388546d 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1442,7 +1442,7 @@
     for (int typeInt = 0; typeInt < GrContextFactory::kContextTypeCnt; ++typeInt) {
         GrContextFactory::ContextType contextType = (GrContextFactory::ContextType) typeInt;
         ContextInfo ctxInfo = factory->getContextInfo(contextType);
-        if (!(*contextTypeFilter)(contextType)) {
+        if (contextTypeFilter && !(*contextTypeFilter)(contextType)) {
             continue;
         }
         // Use "native" instead of explicitly trying OpenGL and OpenGL ES. Do not use GLES on,
diff --git a/tests/GpuColorFilterTest.cpp b/tests/GpuColorFilterTest.cpp
index 558cac3..1788770 100644
--- a/tests/GpuColorFilterTest.cpp
+++ b/tests/GpuColorFilterTest.cpp
@@ -32,7 +32,7 @@
     return color & mask;
 }
 
-DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_ALL_CONTEXTS(GpuColorFilter, reporter, ctxInfo) {
     struct GetConstantComponentTestCase {
         // "Shape drawn with"
         uint32_t inputComponents; // "rgb of", "red of", "alpha of", ...
diff --git a/tests/GrDrawTargetTest.cpp b/tests/GrDrawTargetTest.cpp
index fdcd524..4f92709 100644
--- a/tests/GrDrawTargetTest.cpp
+++ b/tests/GrDrawTargetTest.cpp
@@ -12,7 +12,7 @@
 #include "GrContext.h"
 #include "GrGpu.h"
 
-DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GrDrawTargetPrint, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_ALL_CONTEXTS(GrDrawTargetPrint, reporter, ctxInfo) {
     // This used to assert.
     SkString result = ctxInfo.fGrContext->caps()->dump();
     SkASSERT(!result.isEmpty());
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index b53075b..32973ee 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -252,7 +252,7 @@
     tess.drawPath(args);
 }
 
-DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
+DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
     GrSurfaceDesc desc;
     desc.fFlags = kRenderTarget_GrSurfaceFlag;
     desc.fWidth = 800;
diff --git a/tests/Test.h b/tests/Test.h
index b2cb180..1363f8c 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -156,18 +156,20 @@
             skiatest::Test(#name, true, test_##name));                                       \
     void test_##name(skiatest::Reporter* reporter, sk_gpu_test::GrContextFactory* factory)
 
-#define DEF_GPUTEST_FOR_CONTEXTS(name, contexts, reporter, context_info)            \
-    static void test_##name(skiatest::Reporter*,                                    \
-                            const sk_gpu_test::ContextInfo& context_info);          \
-    static void test_gpu_contexts_##name(skiatest::Reporter* reporter,              \
-                                         sk_gpu_test::GrContextFactory* factory) {  \
-        skiatest::RunWithGPUTestContexts(test_##name, contexts, reporter, factory); \
-    }                                                                               \
-    skiatest::TestRegistry name##TestRegistry(                                      \
-            skiatest::Test(#name, true, test_gpu_contexts_##name));                 \
-    void test_##name(skiatest::Reporter* reporter,                                  \
+#define DEF_GPUTEST_FOR_CONTEXTS(name, context_filter, reporter, context_info)            \
+    static void test_##name(skiatest::Reporter*,                                          \
+                            const sk_gpu_test::ContextInfo& context_info);                \
+    static void test_gpu_contexts_##name(skiatest::Reporter* reporter,                    \
+                                         sk_gpu_test::GrContextFactory* factory) {        \
+        skiatest::RunWithGPUTestContexts(test_##name, context_filter, reporter, factory); \
+    }                                                                                     \
+    skiatest::TestRegistry name##TestRegistry(                                            \
+            skiatest::Test(#name, true, test_gpu_contexts_##name));                       \
+    void test_##name(skiatest::Reporter* reporter,                                        \
                      const sk_gpu_test::ContextInfo& context_info)
 
+#define DEF_GPUTEST_FOR_ALL_CONTEXTS(name, reporter, context_info)                          \
+        DEF_GPUTEST_FOR_CONTEXTS(name, nullptr, reporter, context_info)
 #define DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(name, reporter, context_info)                       \
         DEF_GPUTEST_FOR_CONTEXTS(name, &skiatest::IsGLContextType, reporter, context_info)
 #define DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(name, reporter, context_info)                 \