[ios] Make zlib_unittests pass on iOS.

Change OS_MAC to OS_APPLE to define same behavior for iOS as Mac.
Add globlist, filelist so we can bundle the test data up into
a PAK file to run.

Bug: 1429689
Change-Id: Ib401cda45edab951a8e9483056685734a03edff0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4389623
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125638}
NOKEYCHECK=True
GitOrigin-RevId: d618ef5baebe9f8e93142dfe9557ca72eb2b6066
diff --git a/BUILD.gn b/BUILD.gn
index 5c21586..0ffd486 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -515,6 +515,10 @@
 
     data = [ "google/test/data/" ]
 
+    if (is_ios) {
+      bundle_deps = [ "google:zlib_pak_bundle_data" ]
+    }
+
     deps = [
       ":zlib",
       "google:compression_utils",
diff --git a/google/BUILD.gn b/google/BUILD.gn
index 990b023..122cef5 100644
--- a/google/BUILD.gn
+++ b/google/BUILD.gn
@@ -4,6 +4,10 @@
 
 import("//build_overrides/build.gni")
 
+if (build_with_chromium && is_ios) {
+  import("//build/config/ios/bundle_data_from_filelist.gni")
+}
+
 if (build_with_chromium) {
   static_library("zip") {
     sources = [
@@ -35,6 +39,13 @@
     ]
     public_deps = [ ":compression_utils_portable" ]
   }
+
+  if (is_ios) {
+    bundle_data_from_filelist("zlib_pak_bundle_data") {
+      testonly = true
+      filelist_name = "test_data.filelist"
+    }
+  }
 }
 
 # This allows other users of Chromium's zlib library, but don't use Chromium's
diff --git a/google/test_data.filelist b/google/test_data.filelist
new file mode 100644
index 0000000..0a9d20b
--- /dev/null
+++ b/google/test_data.filelist
@@ -0,0 +1,32 @@
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+# NOTE: this file is generated by build/ios/update_bundle_filelist.py
+#       If it requires updating, you should get a presubmit error with
+#       instructions on how to regenerate. Otherwise, do not edit.
+test/data/Different Encryptions.zip
+test/data/Empty Dir Same Name As File.zip
+test/data/Mixed Paths.zip
+test/data/Parent Dir Same Name As File.zip
+test/data/README.md
+test/data/Repeated Dir Name.zip
+test/data/Repeated File Name With Different Cases.zip
+test/data/Repeated File Name.zip
+test/data/SJIS Bug 846195.zip
+test/data/Windows Special Names.zip
+test/data/Wrong CRC.zip
+test/data/create_test_zip.sh
+test/data/empty.zip
+test/data/evil.zip
+test/data/evil_via_absolute_file_name.zip
+test/data/evil_via_invalid_utf8.zip
+test/data/test.zip
+test/data/test/foo.txt
+test/data/test/foo/bar.txt
+test/data/test/foo/bar/.hidden
+test/data/test/foo/bar/baz.txt
+test/data/test/foo/bar/quux.txt
+test/data/test_encrypted.zip
+test/data/test_mismatch_size.zip
+test/data/test_nocompress.zip
+test/data/test_posix_permissions.zip
diff --git a/google/test_data.globlist b/google/test_data.globlist
new file mode 100644
index 0000000..117a1e5
--- /dev/null
+++ b/google/test_data.globlist
@@ -0,0 +1,8 @@
+# Copyright 2023 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# See build/ios/update_bundle_filelist.py for details on how .globlist
+# files are used to update their .filelist counterparts.
+test/data/**
+test/data/test/foo/bar/.hidden
\ No newline at end of file
diff --git a/google/zip_unittest.cc b/google/zip_unittest.cc
index 24ed147..d0fc02f 100644
--- a/google/zip_unittest.cc
+++ b/google/zip_unittest.cc
@@ -611,7 +611,7 @@
       "NUL .txt",
       "NUL  .txt",
       "NUL  ..txt",
-#ifndef OS_MAC
+#ifndef OS_APPLE
       "Nul.txt",
 #endif
       "nul.very long extension",
@@ -669,7 +669,7 @@
 }
 
 TEST_F(ZipTest, UnzipDifferentCases) {
-#if defined(OS_WIN) || defined(OS_MAC)
+#if defined(OS_WIN) || defined(OS_APPLE)
   // Only the first file (with mixed case) is extracted.
   EXPECT_FALSE(zip::Unzip(GetDataDirectory().AppendASCII(
                               "Repeated File Name With Different Cases.zip"),
@@ -711,7 +711,7 @@
 
   std::string contents;
 
-#if defined(OS_WIN) || defined(OS_MAC)
+#if defined(OS_WIN) || defined(OS_APPLE)
   // Only the first file (with mixed case) has been extracted.
   EXPECT_THAT(
       GetRelativePaths(test_dir_, base::FileEnumerator::FileType::FILES),
@@ -782,7 +782,7 @@
       "Space→ ",                  //
       "c/NUL",                    // Disappears on Windows
       "nul.very long extension",  // Disappears on Windows
-#ifndef OS_MAC
+#ifndef OS_APPLE
       "CASE",                     // Conflicts with "Case"
       "case",                     // Conflicts with "Case"
 #endif