From 344b153599037d2b6ec86d88761a681db25ac7a8 Mon Sep 17 00:00:00 2001 From: Andrew Savage Date: Mon, 3 Jun 2024 17:13:37 -0700 Subject: [PATCH] Revert "Revert "Base cleanups" (#3433)" This reverts commit 9bc5ee34570be6d09e0ed5072c5e483e7fec4b82. --- base/BUILD.gn | 6 ----- .../partition_alloc_base/rand_util_posix.cc | 3 +-- base/check_is_test_unittest.cc | 2 -- base/i18n/time_formatting.cc | 7 +++--- base/test/run_all_unittests.cc | 2 ++ net/base/network_change_notifier_linux.cc | 14 ----------- starboard/build/install/install_target.gni | 3 --- starboard/client_porting/eztime/BUILD.gn | 2 +- starboard/elf_loader/BUILD.gn | 2 +- starboard/extension/BUILD.gn | 3 +-- starboard/linux/shared/BUILD.gn | 2 +- .../x64x11/platform_configuration/BUILD.gn | 11 --------- starboard/nplb/BUILD.gn | 2 +- .../nplb/nplb_evergreen_compat_tests/BUILD.gn | 2 +- starboard/raspi/shared/BUILD.gn | 2 +- .../starboard/player/filter/tools/BUILD.gn | 4 ++-- starboard/win/shared/BUILD.gn | 2 +- testing/perf/BUILD.gn | 2 +- third_party/angle/BUILD.gn | 4 ++-- third_party/boringssl/BUILD.gn | 8 ------- third_party/crashpad/crashpad/client/BUILD.gn | 2 +- third_party/icu/source/common/ubrk.cpp | 1 - .../icu/source/common/unicode/unistr.h | 2 +- third_party/libxml/BUILD.gn | 2 +- third_party/llvm-project/libunwind/BUILD.gn | 2 +- third_party/zlib/BUILD.gn | 6 ++--- .../zlib/google/compression_utils_unittest.cc | 16 ++++++------- .../zlib/google/zip_reader_unittest.cc | 24 +++++++------------ 28 files changed, 44 insertions(+), 94 deletions(-) diff --git a/base/BUILD.gn b/base/BUILD.gn index 342b8c0a7470..5e11519d5720 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -2773,10 +2773,6 @@ component("i18n") { "i18n/utf8_validator_tables.h", ] defines = [ "BASE_I18N_IMPLEMENTATION" ] - defines += [ - "U_COMMON_IMPLEMENTATION", - "UCONFIG_NO_CONVERSION=0", - ] configs += [ "//build/config/compiler:wexit_time_destructors" ] public_deps = [ "//third_party/ced", @@ -3644,8 +3640,6 @@ test("base_unittests") { "//third_party/modp_b64", ] - defines = [ "U_COMMON_IMPLEMENTATION" ] - data_deps = [ ] diff --git a/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc b/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc index c18416ca732b..6019bbc715c3 100644 --- a/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc +++ b/base/allocator/partition_allocator/partition_alloc_base/rand_util_posix.cc @@ -69,8 +69,7 @@ namespace partition_alloc::internal::base { // (https://chromium-review.googlesource.com/c/chromium/src/+/1545096) and land // it or some form of it. void RandBytes(void* output, size_t output_length) { -// TODO(b/298237462): Clean this up for Cobalt or don't use PA. -#if 0 +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // We have to call `getrandom` via Linux Syscall Support, rather than through // the libc wrapper, because we might not have an up-to-date libc (e.g. on // some bots). diff --git a/base/check_is_test_unittest.cc b/base/check_is_test_unittest.cc index fb2ef765b222..3f7fa36ca5b9 100644 --- a/base/check_is_test_unittest.cc +++ b/base/check_is_test_unittest.cc @@ -5,13 +5,11 @@ #include "base/check_is_test.h" #include "testing/gtest/include/gtest/gtest.h" -#include "base/test/allow_check_is_test_for_testing.h" // Note: `base::AllowCheckIsTestForTesting` is being called in // `base/test/launcher/unit_test_launcher.cc` before this test is run. // // Thus, `CHECK_IS_TEST()` will succeed. TEST(CheckIsTest, Usage) { - base::test::AllowCheckIsTestForTesting(); CHECK_IS_TEST(); } diff --git a/base/i18n/time_formatting.cc b/base/i18n/time_formatting.cc index 4f01c76963db..376012e189e4 100644 --- a/base/i18n/time_formatting.cc +++ b/base/i18n/time_formatting.cc @@ -260,10 +260,11 @@ std::u16string DateIntervalFormat(const Time& begin_time, UErrorCode status = U_ZERO_ERROR; std::unique_ptr formatter( -/* Cobalt - icu::DateIntervalFormat::createInstance(DateFormatToString(format), -Cobalt */ +#if defined(USE_HACKY_COBALT_CHANGES) icu::DateIntervalFormat::createInstance(icu::UnicodeString(DateFormatToString(format)), +#else + icu::DateIntervalFormat::createInstance(DateFormatToString(format), +#endif status)); icu::FieldPosition pos = 0; diff --git a/base/test/run_all_unittests.cc b/base/test/run_all_unittests.cc index e9ef642942b6..c3aa04995d6a 100644 --- a/base/test/run_all_unittests.cc +++ b/base/test/run_all_unittests.cc @@ -11,11 +11,13 @@ #if defined(STARBOARD) +#include "base/test/allow_check_is_test_for_testing.h" #include "starboard/client_porting/wrap_main/wrap_main.h" int TestSuiteRun(int argc, char** argv) { base::AtExitManager exit_manager; + base::test::AllowCheckIsTestForTesting(); return base::TestSuite(argc, argv).Run(); } diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc index 1c95268d3ae9..52220d281614 100644 --- a/net/base/network_change_notifier_linux.cc +++ b/net/base/network_change_notifier_linux.cc @@ -30,16 +30,10 @@ class NetworkChangeNotifierLinux::BlockingThreadObjects { // Plumbing for NetworkChangeNotifier::GetCurrentConnectionType. // Safe to call from any thread. NetworkChangeNotifier::ConnectionType GetCurrentConnectionType() { -/* Cobalt return address_tracker_.GetCurrentConnectionType(); -Cobalt */ - return NetworkChangeNotifier::ConnectionType::CONNECTION_UNKNOWN; } -/* Cobalt internal::AddressTrackerLinux* address_tracker() { return &address_tracker_; } -Cobalt */ - internal::AddressTrackerLinux* address_tracker() { return nullptr; } // Begin watching for netlink changes. void Init(); @@ -50,9 +44,7 @@ Cobalt */ void OnIPAddressChanged(); void OnLinkChanged(); // Used to detect online/offline state and IP address changes. -/* Cobalt internal::AddressTrackerLinux address_tracker_; -Cobalt */ NetworkChangeNotifier::ConnectionType last_type_ = NetworkChangeNotifier::CONNECTION_NONE; }; @@ -60,7 +52,6 @@ Cobalt */ NetworkChangeNotifierLinux::BlockingThreadObjects::BlockingThreadObjects( const std::unordered_set& ignored_interfaces, scoped_refptr blocking_thread_runner) -/* Cobalt : address_tracker_( base::BindRepeating(&NetworkChangeNotifierLinux:: BlockingThreadObjects::OnIPAddressChanged, @@ -71,20 +62,15 @@ NetworkChangeNotifierLinux::BlockingThreadObjects::BlockingThreadObjects( base::DoNothing(), ignored_interfaces, std::move(blocking_thread_runner)) {} -Cobalt */ {} void NetworkChangeNotifierLinux::BlockingThreadObjects::Init() { -/* Cobalt address_tracker_.Init(); -Cobalt */ last_type_ = GetCurrentConnectionType(); } void NetworkChangeNotifierLinux::BlockingThreadObjects::InitForTesting( base::ScopedFD netlink_fd) { -/* Cobalt address_tracker_.InitWithFdForTesting(std::move(netlink_fd)); // IN-TEST -Cobalt */ last_type_ = GetCurrentConnectionType(); } diff --git a/starboard/build/install/install_target.gni b/starboard/build/install/install_target.gni index 1d29e0674ed4..bc08211a8d1f 100644 --- a/starboard/build/install/install_target.gni +++ b/starboard/build/install/install_target.gni @@ -40,9 +40,6 @@ template("install_target") { copy("copy_" + target_name) { forward_variables_from(invoker, [ "testonly" ]) - # deps = [] - # not_needed(invoker, [ "deps" ]) - deps = invoker.deps deps += [ installable_target_dep ] sources = [ "$root_out_dir/$source_name" ] diff --git a/starboard/client_porting/eztime/BUILD.gn b/starboard/client_porting/eztime/BUILD.gn index 068980e7e4a0..061c62d3dc70 100644 --- a/starboard/client_porting/eztime/BUILD.gn +++ b/starboard/client_porting/eztime/BUILD.gn @@ -43,7 +43,7 @@ target(gtest_target_type, "eztime_test") { ] data_deps = [ - # "//cobalt/network:copy_ssl_certificates", + "//cobalt/network:copy_ssl_certificates", "//third_party/icu:icudata", ] } diff --git a/starboard/elf_loader/BUILD.gn b/starboard/elf_loader/BUILD.gn index 60c658f5fa29..969dc67f2ac2 100644 --- a/starboard/elf_loader/BUILD.gn +++ b/starboard/elf_loader/BUILD.gn @@ -119,7 +119,7 @@ if (current_toolchain == starboard_toolchain && !is_host_win) { deps += [ "//third_party/crashpad/crashpad/wrapper:wrapper_stub" ] } if (sb_is_evergreen_compatible && sb_evergreen_compatible_package) { - # deps += [ "//starboard/loader_app:copy_crashpad_handler_named_as_so" ] + deps += [ "//starboard/loader_app:copy_crashpad_handler_named_as_so" ] } } } diff --git a/starboard/extension/BUILD.gn b/starboard/extension/BUILD.gn index e440b2aee66a..810ffdb88772 100644 --- a/starboard/extension/BUILD.gn +++ b/starboard/extension/BUILD.gn @@ -14,8 +14,7 @@ target(gtest_target_type, "extension_test") { testonly = true - - # has_pedantic_warnings = true + has_pedantic_warnings = true sources = [ "enhanced_audio_test.cc", "extension_test.cc", diff --git a/starboard/linux/shared/BUILD.gn b/starboard/linux/shared/BUILD.gn index 8537d457fb3e..8e6a662e16dd 100644 --- a/starboard/linux/shared/BUILD.gn +++ b/starboard/linux/shared/BUILD.gn @@ -446,7 +446,7 @@ static_library("starboard_platform_sources") { if (current_toolchain == starboard_toolchain) { target(starboard_level_gtest_target_type, "starboard_platform_tests") { - # build_loader = false + build_loader = false testonly = true sources = media_tests_sources + player_tests_sources + [ diff --git a/starboard/linux/x64x11/platform_configuration/BUILD.gn b/starboard/linux/x64x11/platform_configuration/BUILD.gn index 7a91af178c6e..23738ecb2f44 100644 --- a/starboard/linux/x64x11/platform_configuration/BUILD.gn +++ b/starboard/linux/x64x11/platform_configuration/BUILD.gn @@ -13,17 +13,6 @@ # limitations under the License. config("platform_configuration") { - libs = [ - "X11", - "Xcomposite", - "Xrender", - ] - libs += [ - "asound", - "dl", - "pthread", - "rt", - ] configs = [ "//starboard/build/config/sabi", "//starboard/linux/x64x11/shared/platform_configuration", diff --git a/starboard/nplb/BUILD.gn b/starboard/nplb/BUILD.gn index 7847c001d33c..8907caeaf65d 100644 --- a/starboard/nplb/BUILD.gn +++ b/starboard/nplb/BUILD.gn @@ -320,7 +320,7 @@ target(gtest_target_type, "nplb") { } data_deps = [ - # "//cobalt/network:copy_ssl_certificates", + "//cobalt/network:copy_ssl_certificates", "//starboard/nplb/testdata/file_tests:nplb_file_tests_data", "//starboard/shared/starboard/player:player_download_test_data", "//third_party/icu:icudata", diff --git a/starboard/nplb/nplb_evergreen_compat_tests/BUILD.gn b/starboard/nplb/nplb_evergreen_compat_tests/BUILD.gn index 4332862cbd47..dd54a3e898c8 100644 --- a/starboard/nplb/nplb_evergreen_compat_tests/BUILD.gn +++ b/starboard/nplb/nplb_evergreen_compat_tests/BUILD.gn @@ -34,7 +34,7 @@ target(gtest_target_type, "nplb_evergreen_compat_tests") { ] data_deps = [ - # "//cobalt/network:copy_ssl_certificates", + "//cobalt/network:copy_ssl_certificates", "//third_party/icu:icudata", ] } diff --git a/starboard/raspi/shared/BUILD.gn b/starboard/raspi/shared/BUILD.gn index 3988122640b7..8adaea878175 100644 --- a/starboard/raspi/shared/BUILD.gn +++ b/starboard/raspi/shared/BUILD.gn @@ -22,7 +22,7 @@ group("starboard_platform") { static_library("starboard_platform_sources") { check_includes = false - # has_pedantic_warnings = true + has_pedantic_warnings = true sources = [ "//starboard/linux/shared/atomic_public.h", diff --git a/starboard/shared/starboard/player/filter/tools/BUILD.gn b/starboard/shared/starboard/player/filter/tools/BUILD.gn index 469de56f04db..f1842ff8a6c6 100644 --- a/starboard/shared/starboard/player/filter/tools/BUILD.gn +++ b/starboard/shared/starboard/player/filter/tools/BUILD.gn @@ -14,7 +14,7 @@ if (current_toolchain == starboard_toolchain) { target(starboard_level_final_executable_type, "audio_dmp_player") { - # build_loader = false + build_loader = false sources = [ "audio_dmp_player.cc" ] configs += [ "//starboard/build/config:starboard_implementation" ] public_deps = [ @@ -24,7 +24,7 @@ if (current_toolchain == starboard_toolchain) { "//starboard/shared/starboard/player:video_dmp", ] data_deps = [ - # "//cobalt/network:copy_ssl_certificates", + "//cobalt/network:copy_ssl_certificates", "//starboard/shared/starboard/player:player_download_test_data", "//third_party/icu:icudata", ] diff --git a/starboard/win/shared/BUILD.gn b/starboard/win/shared/BUILD.gn index 792217f80d54..5eb68f55dfea 100644 --- a/starboard/win/shared/BUILD.gn +++ b/starboard/win/shared/BUILD.gn @@ -45,7 +45,7 @@ config("starboard_platform_config") { } static_library("starboard_platform") { - # has_pedantic_warnings = true + has_pedantic_warnings = true sources = [ "//starboard/common/thread.cc", diff --git a/testing/perf/BUILD.gn b/testing/perf/BUILD.gn index fe9b646c7da3..4b7c110af6c3 100644 --- a/testing/perf/BUILD.gn +++ b/testing/perf/BUILD.gn @@ -1 +1 @@ -group("perf") {} \ No newline at end of file +group("perf") {} diff --git a/third_party/angle/BUILD.gn b/third_party/angle/BUILD.gn index a399fa4315fc..0b2272acca75 100644 --- a/third_party/angle/BUILD.gn +++ b/third_party/angle/BUILD.gn @@ -254,7 +254,7 @@ angle_static_library("preprocessor") { sources = angle_preprocessor_sources if (is_starboard) { - # suppressed_configs += [ "//starboard/build/config:warnings_as_errors" ] + suppressed_configs += [ "//starboard/build/config:warnings_as_errors" ] } public_deps = [ @@ -518,7 +518,7 @@ angle_static_library("translator") { public_configs += [ ":external_config" ] if (is_starboard) { - # suppressed_configs += [ "//starboard/build/config:warnings_as_errors" ] + suppressed_configs += [ "//starboard/build/config:warnings_as_errors" ] } deps = [ diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn index d30f5ca9909f..ad88eb2d5f6c 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn @@ -251,7 +251,6 @@ if (!use_cobalt_customizations) { configs -= [ "//starboard/build/config:size" ] configs += [ "//starboard/build/config:speed" ] - # sources += boringssl_linux_x86_64_files if (sb_is_modular) { calling_convention = sabi_variables.calling_convention if ((calling_convention != "aarch64" && calling_convention != "eabi" && @@ -501,10 +500,3 @@ if (build_with_chromium) { seed_corpus = "src/fuzz/server_corpus_no_fuzzer_mode" } } - -# group("boringssl") { -# all_dependent_configs = [ ":external_config" ] -# public_deps = [ -# ":crypto" -# ] -# } \ No newline at end of file diff --git a/third_party/crashpad/crashpad/client/BUILD.gn b/third_party/crashpad/crashpad/client/BUILD.gn index 96775f2cc69a..349c1fbd7d00 100644 --- a/third_party/crashpad/crashpad/client/BUILD.gn +++ b/third_party/crashpad/crashpad/client/BUILD.gn @@ -93,7 +93,7 @@ static_library("client") { deps = [] if (crashpad_is_in_starboard) { - # public_deps += [ "//starboard/elf_loader:evergreen_info" ] + public_deps += [ "//starboard/elf_loader:evergreen_info" ] } if (crashpad_is_in_starboard || crashpad_is_in_native_target_build) { deps += [ "../wrapper/proto:crashpad_annotations_proto" ] diff --git a/third_party/icu/source/common/ubrk.cpp b/third_party/icu/source/common/ubrk.cpp index 108442462134..f8bdf5a6b658 100644 --- a/third_party/icu/source/common/ubrk.cpp +++ b/third_party/icu/source/common/ubrk.cpp @@ -93,7 +93,6 @@ ubrk_open(UBreakIteratorType type, // Invokes the rule builder. // //------------------------------------------------------------------------------ -// static_assert(sizeof(UChar) == 0, "The type T must be an integral type!"); U_CAPI UBreakIterator* U_EXPORT2 ubrk_openRules( const UChar *rules, int32_t rulesLength, diff --git a/third_party/icu/source/common/unicode/unistr.h b/third_party/icu/source/common/unicode/unistr.h index 240ccb5b8f70..456389f265fe 100644 --- a/third_party/icu/source/common/unicode/unistr.h +++ b/third_party/icu/source/common/unicode/unistr.h @@ -3153,7 +3153,7 @@ class U_COMMON_API UnicodeString : public Replaceable */ inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); -#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION || 1 +#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION /** * char* constructor. diff --git a/third_party/libxml/BUILD.gn b/third_party/libxml/BUILD.gn index 1c33ab78f643..24111a245f2a 100644 --- a/third_party/libxml/BUILD.gn +++ b/third_party/libxml/BUILD.gn @@ -349,4 +349,4 @@ if (!use_cobalt_customizations) { include_dirs = [ "$os_include" ] } -group("xml_reader") {} \ No newline at end of file +group("xml_reader") {} diff --git a/third_party/llvm-project/libunwind/BUILD.gn b/third_party/llvm-project/libunwind/BUILD.gn index d344d7109808..d3112b9b4251 100644 --- a/third_party/llvm-project/libunwind/BUILD.gn +++ b/third_party/llvm-project/libunwind/BUILD.gn @@ -142,6 +142,6 @@ static_library("unwind_starboard") { public_deps = [ "//starboard/common", - # "//starboard/elf_loader:evergreen_info", + "//starboard/elf_loader:evergreen_info", ] } diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn index 9267fc44da87..ba3510419e7b 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn @@ -389,7 +389,7 @@ component("zlib_hidden") { } else { sources += [ "arm_stub.c", - # "inflate.c", + "inflate.c", ] } @@ -541,8 +541,8 @@ target(gtest_target_type, "zip_unittests") { testonly = true sources = [ - # "google/compression_utils_unittest.cc", - # "google/zip_reader_unittest.cc", + "google/compression_utils_unittest.cc", + "google/zip_reader_unittest.cc", "google/zip_unittest.cc", "google/compression_utils.cc", "google/compression_utils.h", diff --git a/third_party/zlib/google/compression_utils_unittest.cc b/third_party/zlib/google/compression_utils_unittest.cc index 4c415596d608..0e6aacc9e5d9 100644 --- a/third_party/zlib/google/compression_utils_unittest.cc +++ b/third_party/zlib/google/compression_utils_unittest.cc @@ -35,37 +35,37 @@ const uint8_t kCompressedData[] = { } // namespace TEST(CompressionUtilsTest, GzipCompression) { - std::string data(reinterpret_cast(kData), base::size(kData)); + std::string data(reinterpret_cast(kData), std::size(kData)); std::string compressed_data; EXPECT_TRUE(GzipCompress(data, &compressed_data)); std::string golden_compressed_data( reinterpret_cast(kCompressedData), - base::size(kCompressedData)); + std::size(kCompressedData)); EXPECT_EQ(golden_compressed_data, compressed_data); } TEST(CompressionUtilsTest, GzipUncompression) { std::string compressed_data(reinterpret_cast(kCompressedData), - base::size(kCompressedData)); + std::size(kCompressedData)); std::string uncompressed_data; EXPECT_TRUE(GzipUncompress(compressed_data, &uncompressed_data)); std::string golden_data(reinterpret_cast(kData), - base::size(kData)); + std::size(kData)); EXPECT_EQ(golden_data, uncompressed_data); } TEST(CompressionUtilsTest, GzipUncompressionFromStringPieceToString) { base::StringPiece compressed_data( reinterpret_cast(kCompressedData), - base::size(kCompressedData)); + std::size(kCompressedData)); std::string uncompressed_data; EXPECT_TRUE(GzipUncompress(compressed_data, &uncompressed_data)); std::string golden_data(reinterpret_cast(kData), - base::size(kData)); + std::size(kData)); EXPECT_EQ(golden_data, uncompressed_data); } @@ -123,10 +123,10 @@ TEST(CompressionUtilsTest, OutputCompressionAndDecompressionDuration) { TEST(CompressionUtilsTest, InPlace) { const std::string original_data(reinterpret_cast(kData), - base::size(kData)); + std::size(kData)); const std::string golden_compressed_data( reinterpret_cast(kCompressedData), - base::size(kCompressedData)); + std::size(kCompressedData)); std::string data(original_data); EXPECT_TRUE(GzipCompress(data, &data)); diff --git a/third_party/zlib/google/zip_reader_unittest.cc b/third_party/zlib/google/zip_reader_unittest.cc index 839c3ee55009..ad69c85cfb53 100644 --- a/third_party/zlib/google/zip_reader_unittest.cc +++ b/third_party/zlib/google/zip_reader_unittest.cc @@ -15,12 +15,14 @@ #include "base/files/file.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" +#include "base/hash/md5.h" #include "base/logging.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/task_environment.h" #include "base/time/time.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,12 +30,7 @@ #include "third_party/zlib/google/zip_internal.h" #if defined(STARBOARD) -#include "base/md5.h" -#include "base/test/scoped_task_environment.h" #include "starboard/common/log.h" -#else -#include "base/hash/md5.h" -#include "base/test/task_environment.h" #endif using ::testing::Return; @@ -229,12 +226,7 @@ class ZipReaderTest : public PlatformTest { std::set test_zip_contents_; base::ScopedTempDir temp_dir_; - -#if defined(STARBOARD) - base::test::ScopedTaskEnvironment scoped_task_environment_; -#else base::test::TaskEnvironment task_environment_; -#endif }; TEST_F(ZipReaderTest, Open_ValidZipFile) { @@ -431,7 +423,7 @@ TEST_F(ZipReaderTest, OpenFromString) { "\x50\x75\x78\x0b\x00\x01\x04\x8e\xf0\x00\x00\x04\x88\x13\x00\x00" "\x50\x4b\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00\x4e\x00\x00\x00" "\x52\x00\x00\x00\x00\x00"; - std::string data(kTestData, base::size(kTestData)); + std::string data(kTestData, std::size(kTestData)); ZipReader reader; ASSERT_TRUE(reader.OpenFromString(data)); base::FilePath target_path(FILE_PATH_LITERAL("test.txt")); @@ -445,6 +437,7 @@ TEST_F(ZipReaderTest, OpenFromString) { EXPECT_EQ(std::string("This is a test.\n"), actual); } +#if !defined(COBALT_PENDING_CLEAN_UP) // Verifies that the asynchronous extraction to a file works. TEST_F(ZipReaderTest, ExtractToFileAsync_RegularFile) { MockUnzipListener listener; @@ -511,6 +504,7 @@ TEST_F(ZipReaderTest, ExtractToFileAsync_Directory) { ASSERT_TRUE(base::DirectoryExists(target_file)); } +#endif TEST_F(ZipReaderTest, ExtractCurrentEntryToString) { // test_mismatch_size.zip contains files with names from 0.txt to 7.txt with @@ -538,12 +532,12 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryToString) { if (i > 0) { // Exact byte read limit: must pass. EXPECT_TRUE(reader.ExtractCurrentEntryToString(i, &contents)); - EXPECT_EQ(base::StringPiece("0123456", i).as_string(), contents); + EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents); } // More than necessary byte read limit: must pass. EXPECT_TRUE(reader.ExtractCurrentEntryToString(16, &contents)); - EXPECT_EQ(base::StringPiece("0123456", i).as_string(), contents); + EXPECT_EQ(std::string(base::StringPiece("0123456", i)), contents); } reader.Close(); } @@ -688,7 +682,7 @@ class FileWriterDelegateTest : public ::testing::Test { file_.Initialize(temp_file_path_, (base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_READ | base::File::FLAG_WRITE | - base::File::FLAG_TEMPORARY + base::File::FLAG_WIN_TEMPORARY #if !defined(STARBOARD) | base::File::FLAG_DELETE_ON_CLOSE #endif @@ -699,7 +693,7 @@ class FileWriterDelegateTest : public ::testing::Test { #if defined(STARBOARD) void TearDown() override { file_.Close(); - ASSERT_TRUE(base::DeleteFile(temp_file_path_, false)); + ASSERT_TRUE(base::DeleteFile(temp_file_path_)); } #endif