Chromium Code Reviews| Index: chrome/browser/safe_browsing/download_protection_service_unittest.cc |
| diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
| index 34bcf1a3ddabff50b99c62c28f89cf9e0eda97af..a99bb6173c85b235f414b6ac00909420e621e69d 100644 |
| --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
| +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
| @@ -35,7 +35,7 @@ |
| #include "net/url_request/url_request_status.h" |
| #include "testing/gmock/include/gmock/gmock.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -#include "third_party/zlib/google/zip.h" |
| +#include "third_party/zlib/google/zip_writer.h" |
| #include "url/gurl.h" |
| using ::testing::Assign; |
| @@ -707,13 +707,10 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { |
| // Write out a zip archive to the temporary file. In this case, it |
| // only contains a text file. |
| - base::ScopedTempDir zip_source_dir; |
| - ASSERT_TRUE(zip_source_dir.CreateUniqueTempDir()); |
| - std::string file_contents = "dummy file"; |
| - ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile( |
| - zip_source_dir.path().Append(FILE_PATH_LITERAL("file.txt")), |
| - file_contents.data(), file_contents.size())); |
| - ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false)); |
| + zip::ZipWriter writer; |
| + writer.AddFile(base::FilePath(FILE_PATH_LITERAL("file.txt")), |
| + base::StringPiece("dummy file", 10)); |
|
satorux1
2014/03/24 06:16:07
please drop ", 10". this should be unnecessary.
|
| + ASSERT_TRUE(writer.Commit(a_tmp, zip::ZipWriter::OverWrite)); |
| download_service_->CheckClientDownload( |
| &item, |
| @@ -725,10 +722,9 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { |
| Mock::VerifyAndClearExpectations(signature_util_.get()); |
| // Now check with an executable in the zip file as well. |
| - ASSERT_EQ(static_cast<int>(file_contents.size()), file_util::WriteFile( |
| - zip_source_dir.path().Append(FILE_PATH_LITERAL("file.exe")), |
| - file_contents.data(), file_contents.size())); |
| - ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false)); |
| + writer.AddFile(base::FilePath(FILE_PATH_LITERAL("file.exe")), |
| + base::StringPiece("dummy file", 10)); |
|
satorux1
2014/03/24 06:16:07
ditto
|
| + ASSERT_TRUE(writer.Commit(a_tmp, zip::ZipWriter::OverWrite)); |
| EXPECT_CALL(*sb_service_->mock_database_manager(), |
| MatchDownloadWhitelistUrl(_)) |