Roll third_party/googletest/src/ af29db7ec..e4fdb87e7 (411 commits)

Update gtest_port_wrapper.cc so it builds with modern GoogleTest. Follow
Chromium's changes and omit the GTEST_HAS_ABSL define to make this
build. Also follow Chromium's changes and temporarily add gmock/gtest to
GN's no_check_targets list.

https://chromium.googlesource.com/external/github.com/google/googletest.git/+log/af29db7ec28d..e4fdb87e76b9

Created with:
  roll-dep third_party/googletest/src

Change-Id: I9ea694f3357d43d3192b8f830ad394143db57bfe
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/117355
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/.gn b/.gn
index 9d6330b..f7299b8 100644
--- a/.gn
+++ b/.gn
@@ -21,6 +21,12 @@
 }
 
 no_check_targets = [
+  # TODO(crbug.com/326607005): Remove the exceptions for googletest once it is
+  # possible to support Abseil flags in tests without regressing things (e.g.
+  # no added static initializers) in production binaries.
+  "//third_party/googletest:gmock",
+  "//third_party/googletest:gtest",
+
   # See https://crbug.com/v8/7330 and/or check if these entries exist in
   # Chromium's //.gn file.
   "//v8:cppgc_base",
diff --git a/DEPS b/DEPS
index 8253cd1..c97886c 100644
--- a/DEPS
+++ b/DEPS
@@ -113,7 +113,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling gtest
   # and whatever else without interference from each other.
-  'gtest_revision': 'af29db7ec28d6df1c7f0f745186884091e602e07',
+  'gtest_revision': 'e4fdb87e76b9fc4b01c54ad81aea19d6e994b994',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling icu
   # and whatever else without interference from each other.
diff --git a/third_party/googletest/BUILD.gn b/third_party/googletest/BUILD.gn
index c6c638f..f017005 100644
--- a/third_party/googletest/BUILD.gn
+++ b/third_party/googletest/BUILD.gn
@@ -24,8 +24,6 @@
 
     # Prevents gtest from including both <tr1/tuple> and <tuple>.
     "GTEST_HAS_TR1_TUPLE=0",
-
-    "GTEST_HAS_ABSL=1",
   ]
 
   configs = [ "//third_party/abseil-cpp:absl_include_config" ]
diff --git a/third_party/googletest/custom/gtest/internal/custom/gtest_port_wrapper.cc b/third_party/googletest/custom/gtest/internal/custom/gtest_port_wrapper.cc
index 6d632f4..6b81e40 100644
--- a/third_party/googletest/custom/gtest/internal/custom/gtest_port_wrapper.cc
+++ b/third_party/googletest/custom/gtest/internal/custom/gtest_port_wrapper.cc
@@ -71,6 +71,9 @@
     close(captured_fd);
   }
 
+  CapturedStream(const CapturedStream&) = delete;
+  CapturedStream& operator=(const CapturedStream&) = delete;
+
   ~CapturedStream() { remove(filename_.c_str()); }
 
   std::string GetCapturedString() {
@@ -97,8 +100,6 @@
   int uncaptured_fd_;
   // Name of the temporary file holding the stderr output.
   ::std::string filename_;
-
-  GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
 };
 
 GTEST_DISABLE_MSC_DEPRECATED_POP_()
@@ -127,6 +128,15 @@
   return content;
 }
 
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
+const int kStdOutFileno = 1;
+const int kStdErrFileno = 2;
+#else
+const int kStdOutFileno = STDOUT_FILENO;
+const int kStdErrFileno = STDERR_FILENO;
+#endif  // defined(_MSC_VER) || defined(__BORLANDC__)
+
 // Starts capturing stdout.
 void CaptureStdout() {
   CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);