image_diff: respect use_system_zlib build argument

When building pdfium with a system provided copy of zlib we should build
image_diff the same way.

Change-Id: I5d1be6dcb09823c90085a1b33bb5c26b89243d8d
Reviewed-on: https://pdfium-review.googlesource.com/c/50030
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/image_diff/BUILD.gn b/testing/image_diff/BUILD.gn
index 35c0d57..7d77723 100644
--- a/testing/image_diff/BUILD.gn
+++ b/testing/image_diff/BUILD.gn
@@ -15,6 +15,6 @@
   deps = [
     "../../third_party:pdfium_base",
     "../../third_party:png",
-    "//third_party/zlib",
+    "../../third_party:zlib",
   ]
 }
diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp
index 89c08f1..d2c9099 100644
--- a/testing/image_diff/image_diff_png.cpp
+++ b/testing/image_diff/image_diff_png.cpp
@@ -18,7 +18,12 @@
 
 #include "third_party/base/compiler_specific.h"
 #include "third_party/base/logging.h"
+
+#ifdef USE_SYSTEM_ZLIB
+#include <zlib.h>
+#else
 #include "third_party/zlib/zlib.h"
+#endif
 
 #ifdef USE_SYSTEM_LIBPNG
 #include <png.h>