Only default ANGLE to swiftshader if envvar empty.

Only set SwiftShader as the default ANGLE backend if the
ANGLE_DEFAULT_PLATFORM environment var is empty. This will allow
devs to set it.

Bug: dawn:447
Change-Id: I49aac4bcb4b0b7c56903eca68248ee22cdf1e6f2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41140
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 0f3b3fc..e2c0666 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -381,7 +381,9 @@
     adapterOptions.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress);
     instance->DiscoverAdapters(&adapterOptions);
 
-    SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", "swiftshader");
+    if (GetEnvironmentVar("ANGLE_DEFAULT_PLATFORM").empty()) {
+        SetEnvironmentVar("ANGLE_DEFAULT_PLATFORM", "swiftshader");
+    }
 
     glfwDefaultWindowHints();
     glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);