Commit 481622c5 authored by Daniel Rubery's avatar Daniel Rubery Committed by Commit Bot

Add test to ensure we ping for valid DMG

Bug: 882927
Change-Id: I7217526edbe448fd9588ef0b8a2554e1e969651e
Reviewed-on: https://chromium-review.googlesource.com/c/1255725
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595900}
parent 43ffa309
......@@ -1416,6 +1416,39 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadReportCorruptDmg) {
CheckClientDownloadReportCorruptArchive(DMG);
}
TEST_F(DownloadProtectionServiceTest, CheckClientDownloadReportValidDmg) {
PrepareResponse(ClientDownloadResponse::SAFE, net::HTTP_OK,
net::URLRequestStatus::SUCCESS);
base::FilePath test_dmg;
EXPECT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &test_dmg));
test_dmg = test_dmg.AppendASCII("safe_browsing")
.AppendASCII("mach_o")
.AppendASCII("signed-archive.dmg");
NiceMockDownloadItem item;
PrepareBasicDownloadItemWithFullPaths(
&item, {"http://www.evil.com/a.dmg"}, // url_chain
"http://www.google.com/", // referrer
test_dmg, // tmp_path
temp_dir_.GetPath().Append(FILE_PATH_LITERAL("a.dmg"))); // final_path
RunLoop run_loop;
download_service_->CheckClientDownload(
&item,
base::BindRepeating(&DownloadProtectionServiceTest::CheckDoneCallback,
base::Unretained(this), run_loop.QuitClosure()));
run_loop.Run();
ASSERT_TRUE(HasClientDownloadRequest());
EXPECT_TRUE(GetClientDownloadRequest()->archive_valid());
ClearClientDownloadRequest();
Mock::VerifyAndClearExpectations(sb_service_.get());
Mock::VerifyAndClearExpectations(binary_feature_extractor_.get());
}
// Tests that signatures get recorded and uploaded for signed DMGs.
TEST_F(DownloadProtectionServiceTest,
CheckClientDownloadReportDmgWithSignature) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment