gn2bp: use Android libgtest_prod_headers

This requires aosp/2366787 to work.
Unfortunately, Chromium does not add a dependency on gtest, so
builtin_module cannot be used.
Using the gtest prod headers from Android is fine for //base. The only
thing that's used is gtest_prod.h, which includes one friend macro that
hasn't changed in 14 years.

Test: build cronet
Change-Id: I03b12ae698699527da7e69c9d4d50da1822fd5bc
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index b87b969..3d32f0a 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -228,6 +228,9 @@
         "buildtools/third_party/libc++abi/trunk/include",
         "third_party/android_ndk/sources/android/cpufeatures/",
     ],
+    header_libs: [
+        "libgtest_prod_headers",
+    ],
     cpp_std: "c++17",
     target: {
         android_arm: {
@@ -898,6 +901,9 @@
         "cronet_aml_build_chromeos_buildflags",
         "cronet_aml_build_config_compiler_compiler_buildflags",
     ],
+    export_header_lib_headers: [
+        "libgtest_prod_headers",
+    ],
     defaults: [
         "cronet_aml_defaults",
     ],
@@ -935,6 +941,9 @@
         "third_party/icu/source/common/",
         "third_party/icu/source/i18n/",
     ],
+    header_libs: [
+        "libgtest_prod_headers",
+    ],
     cpp_std: "c++17",
     target: {
         android_arm: {
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index db2fa13..f7eb30f 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -142,6 +142,22 @@
             'cronet_aml_crypto_crypto',
         }),
     ],
+    # TODO: fix upstream. Both //base:base and
+    # //base/allocator/partition_allocator:partition_alloc do not create a
+    # dependency on gtest despite using gtest_prod.h.
+    'cronet_aml_base_base': [
+        ('header_libs', {
+            'libgtest_prod_headers',
+        }),
+        ('export_header_lib_headers', {
+            'libgtest_prod_headers',
+        }),
+    ],
+    'cronet_aml_base_allocator_partition_allocator_partition_alloc': [
+        ('header_libs', {
+            'libgtest_prod_headers',
+        }),
+    ],
 }
 
 def enable_brotli(module, arch):
@@ -323,6 +339,7 @@
     self.generated_headers = set()
     self.export_generated_headers = set()
     self.export_static_lib_headers = set()
+    self.export_header_lib_headers = set()
     self.defaults = set()
     self.cflags = set()
     self.include_dirs = set()
@@ -393,6 +410,7 @@
     self._output_field(output, 'generated_headers')
     self._output_field(output, 'export_generated_headers')
     self._output_field(output, 'export_static_lib_headers')
+    self._output_field(output, 'export_header_lib_headers')
     self._output_field(output, 'defaults')
     self._output_field(output, 'cflags')
     self._output_field(output, 'include_dirs')