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..448eb5457bc58a9b21c07b5a49168fde051dd5f2 100644 |
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
@@ -13,7 +13,7 @@ |
#include "base/file_util.h" |
#include "base/files/file_path.h" |
#include "base/files/scoped_temp_dir.h" |
-#include "base/memory/ref_counted.h" |
+#include "base/memory/ref_counted_memory.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/path_service.h" |
@@ -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::ZipContents zip_contents; |
+ zip_contents[base::FilePath(FILE_PATH_LITERAL("file.txt"))] = |
+ new base::RefCountedStaticMemory("dummy file", 10); |
+ ASSERT_TRUE(zip::ZipFromMemory(a_tmp, zip_contents, false)); |
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)); |
+ zip_contents[base::FilePath(FILE_PATH_LITERAL("file.exe"))] = |
+ new base::RefCountedStaticMemory("dummy file", 10); |
+ ASSERT_TRUE(zip::ZipFromMemory(a_tmp, zip_contents, false)); |
EXPECT_CALL(*sb_service_->mock_database_manager(), |
MatchDownloadWhitelistUrl(_)) |