Make ZipEntryTest time-insensitive
Fix ZipEntryTest to not depend on the current system time. The ZIP format represents timestamps outside of DOS time (before 1980) via an extra field. ZipEntryTest.testCommentAndExtraInSameOrder() asserts that the extra field can be read back unchanged, but since it defaulted to the current system time, this check failed when the system time was before 1980. This CL fixes the test by explicitly setting a timestamp in 2010 on the new entry. It also adds new tests for the behavior difference before/after 1980. Bug: 37696493 Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ libcore.java.util.zip.ZipEntryTest Test: cts-tradefed run cts -m CtsLibcoreTestCases -t \ libcore.java.util.zip.ZipOutputStreamTest Change-Id: I179c193e503ec1f2c5549327ab64a15a33e5866b
Loading
Please sign in to comment