| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <set> | 5 #include <set> |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 EXPECT_EQ(count, zip_contents_.size()); | 69 EXPECT_EQ(count, zip_contents_.size()); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // the path to temporary directory used to contain the test operations | 72 // the path to temporary directory used to contain the test operations |
| 73 FilePath test_dir_; | 73 FilePath test_dir_; |
| 74 | 74 |
| 75 // hard-coded contents of a known zip file | 75 // hard-coded contents of a known zip file |
| 76 std::set<FilePath> zip_contents_; | 76 std::set<FilePath> zip_contents_; |
| 77 }; | 77 }; |
| 78 // TODO(aa): re-enable this test for Mac (was disabled temporarily to clear | 78 |
| 79 // valgrind error on mac. | |
| 80 #if !defined(OS_MACOSX) | |
| 81 TEST_F(ZipTest, Unzip) { | 79 TEST_F(ZipTest, Unzip) { |
| 82 TestUnzipFile(FILE_PATH_LITERAL("test.zip")); | 80 TestUnzipFile(FILE_PATH_LITERAL("test.zip")); |
| 83 } | 81 } |
| 84 | 82 |
| 85 TEST_F(ZipTest, UnzipUncompressed) { | 83 TEST_F(ZipTest, UnzipUncompressed) { |
| 86 TestUnzipFile(FILE_PATH_LITERAL("test_nocompress.zip")); | 84 TestUnzipFile(FILE_PATH_LITERAL("test_nocompress.zip")); |
| 87 } | 85 } |
| 88 | 86 |
| 89 | 87 |
| 90 TEST_F(ZipTest, Zip) { | 88 TEST_F(ZipTest, Zip) { |
| 91 FilePath src_dir; | 89 FilePath src_dir; |
| 92 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &src_dir)); | 90 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &src_dir)); |
| 93 src_dir = src_dir.AppendASCII("zip").AppendASCII("test"); | 91 src_dir = src_dir.AppendASCII("zip").AppendASCII("test"); |
| 94 | 92 |
| 95 FilePath zip_file; | 93 FilePath zip_file; |
| 96 ASSERT_TRUE(file_util::CreateNewTempDirectory( | 94 ASSERT_TRUE(file_util::CreateNewTempDirectory( |
| 97 FILE_PATH_LITERAL("unzip_unittest_"), &zip_file)); | 95 FILE_PATH_LITERAL("unzip_unittest_"), &zip_file)); |
| 98 zip_file = zip_file.AppendASCII("out.zip"); | 96 zip_file = zip_file.AppendASCII("out.zip"); |
| 99 | 97 |
| 100 EXPECT_TRUE(Zip(src_dir, zip_file)); | 98 EXPECT_TRUE(Zip(src_dir, zip_file)); |
| 101 | 99 |
| 102 TestUnzipFile(zip_file); | 100 TestUnzipFile(zip_file); |
| 103 | 101 |
| 104 EXPECT_TRUE(file_util::Delete(zip_file, false)); | 102 EXPECT_TRUE(file_util::Delete(zip_file, false)); |
| 105 } | 103 } |
| 106 #endif // !defined(OS_MACOSX) | 104 |
| 107 } // namespace | 105 } // namespace |
| OLD | NEW |