OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 383 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
384 base::Unretained(this))); | 384 base::Unretained(this))); |
385 msg_loop_.Run(); | 385 msg_loop_.Run(); |
386 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); | 386 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); |
387 } | 387 } |
388 | 388 |
389 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { | 389 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { |
390 net::FakeURLFetcherFactory factory(NULL); | 390 net::FakeURLFetcherFactory factory(NULL); |
391 // HTTP request will fail. | 391 // HTTP request will fail. |
392 factory.SetFakeResponse( | 392 factory.SetFakeResponse( |
393 DownloadProtectionService::GetDownloadRequestUrl(), "", false); | 393 DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false); |
394 | 394 |
395 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); | 395 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); |
396 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); | 396 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); |
397 std::vector<GURL> url_chain; | 397 std::vector<GURL> url_chain; |
398 url_chain.push_back(GURL("http://www.evil.com/a.exe")); | 398 url_chain.push_back(GURL("http://www.evil.com/a.exe")); |
399 GURL referrer("http://www.google.com/"); | 399 GURL referrer("http://www.google.com/"); |
400 std::string hash = "hash"; | 400 std::string hash = "hash"; |
401 | 401 |
402 content::MockDownloadItem item; | 402 content::MockDownloadItem item; |
403 EXPECT_CALL(item, AddObserver(_)); | 403 EXPECT_CALL(item, AddObserver(_)); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 1074 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); |
1075 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); | 1075 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); |
1076 | 1076 |
1077 cert = ReadTestCertificate("test_c.pem"); | 1077 cert = ReadTestCertificate("test_c.pem"); |
1078 ASSERT_TRUE(cert.get()); | 1078 ASSERT_TRUE(cert.get()); |
1079 whitelist_strings.clear(); | 1079 whitelist_strings.clear(); |
1080 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 1080 GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); |
1081 EXPECT_THAT(whitelist_strings, ElementsAre()); | 1081 EXPECT_THAT(whitelist_strings, ElementsAre()); |
1082 } | 1082 } |
1083 } // namespace safe_browsing | 1083 } // namespace safe_browsing |
OLD | NEW |