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 53d3bb2fe5e3601653cbbef97b72475d5e02516d..0323c725afebfdec6713d0e0e31a423944db7b56 100644 |
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc |
@@ -1114,6 +1114,38 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { |
EXPECT_FALSE(HasClientDownloadRequest()); |
#endif |
Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); |
+ |
+ // Repeat the test with an archive inside the zip file. |
+ ASSERT_EQ(static_cast<int>(file_contents.size()), base::WriteFile( |
+ zip_source_dir.path().Append(FILE_PATH_LITERAL("file.rar")), |
+ file_contents.data(), file_contents.size())); |
+ ASSERT_TRUE(zip::Zip(zip_source_dir.path(), a_tmp, false)); |
mattm
2015/07/29 22:53:25
Isn't this creating a zip with file.txt, file.exe,
asanka
2015/07/31 01:04:42
Indeed. Fixed by testing both with file.exe and wi
|
+ |
+ EXPECT_CALL(*sb_service_->mock_database_manager(), |
+ MatchDownloadWhitelistUrl(_)) |
+ .WillRepeatedly(Return(false)); |
+ |
+ download_service_->CheckClientDownload( |
+ &item, |
+ base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
+ base::Unretained(this))); |
+ MessageLoop::current()->Run(); |
+ |
+#if defined(OS_WIN) || defined(OS_MACOSX) |
+ EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); |
+ EXPECT_TRUE(HasClientDownloadRequest()); |
+ EXPECT_EQ(0, GetClientDownloadRequest()->archived_binary_size()); |
+ EXPECT_TRUE(GetClientDownloadRequest()->has_download_type()); |
+ EXPECT_EQ(ClientDownloadRequest_DownloadType_ZIPPED_ARCHIVE, |
+ GetClientDownloadRequest()->download_type()); |
+ ClearClientDownloadRequest(); |
+#else |
+ // For !(OS_WIN || OS_MACOSX), no file types are currently supported. Hence |
+ // the resulting verdict is UNKNOWN. |
+ EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
+ EXPECT_FALSE(HasClientDownloadRequest()); |
+#endif |
+ Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); |
} |
TEST_F(DownloadProtectionServiceTest, CheckClientDownloadCorruptZip) { |