| 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 be3ca1ee14f763929f19977bb258716a7b8bcc57..2b126274453ec301508fd0e36783949eada1ea51 100644
|
| --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
|
| +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
|
| @@ -224,10 +224,14 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) {
|
| }
|
|
|
| TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
|
| + ClientDownloadResponse response;
|
| + response.set_verdict(ClientDownloadResponse::SAFE);
|
| FakeURLFetcherFactory factory;
|
| // Empty response means SAFE.
|
| factory.SetFakeResponse(
|
| - DownloadProtectionService::kDownloadRequestUrl, "", true);
|
| + DownloadProtectionService::kDownloadRequestUrl,
|
| + response.SerializeAsString(),
|
| + true);
|
|
|
| EXPECT_CALL(*sb_service_, MatchDownloadWhitelistUrl(_))
|
| .WillRepeatedly(Return(false));
|
| @@ -244,8 +248,11 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
|
| EXPECT_EQ(DownloadProtectionService::SAFE, result_);
|
|
|
| // Invalid response should be safe too.
|
| + response.Clear();
|
| factory.SetFakeResponse(
|
| - DownloadProtectionService::kDownloadRequestUrl, "bla", true);
|
| + DownloadProtectionService::kDownloadRequestUrl,
|
| + response.SerializePartialAsString(),
|
| + true);
|
|
|
| download_service_->CheckClientDownload(
|
| info,
|
| @@ -253,6 +260,20 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
|
| base::Unretained(this)));
|
| msg_loop_.Run();
|
| EXPECT_EQ(DownloadProtectionService::SAFE, result_);
|
| +
|
| + // If the response is dangerous the result should also be marked as dangerous.
|
| + response.set_verdict(ClientDownloadResponse::DANGEROUS);
|
| + factory.SetFakeResponse(
|
| + DownloadProtectionService::kDownloadRequestUrl,
|
| + response.SerializeAsString(),
|
| + true);
|
| +
|
| + download_service_->CheckClientDownload(
|
| + info,
|
| + base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
|
| + base::Unretained(this)));
|
| + msg_loop_.Run();
|
| + EXPECT_EQ(DownloadProtectionService::DANGEROUS, result_);
|
| }
|
|
|
| TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) {
|
|
|