From 0b0a7fe0c948b22c0d9f46debdfd2fe3436db716 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Fri, 5 Feb 2010 11:22:39 -0800 Subject: [PATCH] Bug 543101: (Test-only change) When comparing filesystem timestamps to zip-file timestamps in zipwriter tests, truncate both values to second precision. r=dtownsend. CLOSED TREE --- modules/libjar/zipwriter/test/unit/head_zipwriter.js | 2 ++ modules/libjar/zipwriter/test/unit/test_asyncadd.js | 4 ++-- modules/libjar/zipwriter/test/unit/test_sync.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/libjar/zipwriter/test/unit/head_zipwriter.js b/modules/libjar/zipwriter/test/unit/head_zipwriter.js index 2134263ae9cb..838c6ca9a4a1 100644 --- a/modules/libjar/zipwriter/test/unit/head_zipwriter.js +++ b/modules/libjar/zipwriter/test/unit/head_zipwriter.js @@ -58,6 +58,8 @@ const ZIP_METHOD_DEFLATE = 8 const ZIP_EXTENDED_TIMESTAMP_SIZE = 9; const PR_USEC_PER_MSEC = 1000; +const PR_USEC_PER_SEC = 1000000; +const PR_MSEC_PER_SEC = 1000; const DATA_DIR = "data/"; diff --git a/modules/libjar/zipwriter/test/unit/test_asyncadd.js b/modules/libjar/zipwriter/test/unit/test_asyncadd.js index c63866fe5b07..40e850c922f1 100644 --- a/modules/libjar/zipwriter/test/unit/test_asyncadd.js +++ b/modules/libjar/zipwriter/test/unit/test_asyncadd.js @@ -77,8 +77,8 @@ var observer = { do_check_eq(entry.realSize, TESTS[i].size); do_check_eq(entry.size, TESTS[i].size); do_check_eq(entry.CRC32, TESTS[i].crc); - do_check_eq(entry.lastModifiedTime / PR_USEC_PER_MSEC, - source.lastModifiedTime); + do_check_eq(Math.floor(entry.lastModifiedTime / PR_USEC_PER_SEC), + Math.floor(source.lastModifiedTime / PR_MSEC_PER_SEC)); zipR.test(TESTS[i].name); } diff --git a/modules/libjar/zipwriter/test/unit/test_sync.js b/modules/libjar/zipwriter/test/unit/test_sync.js index 37f710c46eda..e5fbd9f269b8 100644 --- a/modules/libjar/zipwriter/test/unit/test_sync.js +++ b/modules/libjar/zipwriter/test/unit/test_sync.js @@ -80,8 +80,8 @@ function run_test() do_check_eq(entry.realSize, TESTS[i].size); do_check_eq(entry.size, TESTS[i].size); do_check_eq(entry.CRC32, TESTS[i].crc); - do_check_eq(entry.lastModifiedTime / PR_USEC_PER_MSEC, - source.lastModifiedTime); + do_check_eq(Math.floor(entry.lastModifiedTime / PR_USEC_PER_SEC), + Math.floor(source.lastModifiedTime / PR_MSEC_PER_SEC)); zipR.test(TESTS[i].name); }