Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service_unittest.cc

Issue 48713008: [sync] Allow FakeURLFetcher to return arbitrary HTTP response codes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "chrome/browser/safe_browsing/database_manager.h" 24 #include "chrome/browser/safe_browsing/database_manager.h"
25 #include "chrome/browser/safe_browsing/download_feedback_service.h" 25 #include "chrome/browser/safe_browsing/download_feedback_service.h"
26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
27 #include "chrome/browser/safe_browsing/signature_util.h" 27 #include "chrome/browser/safe_browsing/signature_util.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/safe_browsing/csd.pb.h" 29 #include "chrome/common/safe_browsing/csd.pb.h"
30 #include "content/public/browser/render_process_host.h" 30 #include "content/public/browser/render_process_host.h"
31 #include "content/public/test/mock_download_item.h" 31 #include "content/public/test/mock_download_item.h"
32 #include "content/public/test/test_browser_thread_bundle.h" 32 #include "content/public/test/test_browser_thread_bundle.h"
33 #include "net/cert/x509_certificate.h" 33 #include "net/cert/x509_certificate.h"
34 #include "net/http/http_status_code.h"
34 #include "net/url_request/test_url_fetcher_factory.h" 35 #include "net/url_request/test_url_fetcher_factory.h"
35 #include "net/url_request/url_fetcher_delegate.h" 36 #include "net/url_request/url_fetcher_delegate.h"
36 #include "testing/gmock/include/gmock/gmock.h" 37 #include "testing/gmock/include/gmock/gmock.h"
37 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
38 #include "third_party/zlib/google/zip.h" 39 #include "third_party/zlib/google/zip.h"
39 #include "url/gurl.h" 40 #include "url/gurl.h"
40 41
41 using ::testing::Assign; 42 using ::testing::Assign;
42 using ::testing::ContainerEq; 43 using ::testing::ContainerEq;
43 using ::testing::DoAll; 44 using ::testing::DoAll;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 398 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
398 base::Unretained(this))); 399 base::Unretained(this)));
399 MessageLoop::current()->Run(); 400 MessageLoop::current()->Run();
400 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 401 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
401 } 402 }
402 403
403 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { 404 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) {
404 net::FakeURLFetcherFactory factory(NULL); 405 net::FakeURLFetcherFactory factory(NULL);
405 // HTTP request will fail. 406 // HTTP request will fail.
406 factory.SetFakeResponse( 407 factory.SetFakeResponse(
407 DownloadProtectionService::GetDownloadRequestUrl(), std::string(), false); 408 DownloadProtectionService::GetDownloadRequestUrl(),
409 std::string(),
410 net::HTTP_INTERNAL_SERVER_ERROR);
408 411
409 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); 412 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
410 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); 413 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
411 std::vector<GURL> url_chain; 414 std::vector<GURL> url_chain;
412 url_chain.push_back(GURL("http://www.evil.com/a.exe")); 415 url_chain.push_back(GURL("http://www.evil.com/a.exe"));
413 GURL referrer("http://www.google.com/"); 416 GURL referrer("http://www.google.com/");
414 std::string hash = "hash"; 417 std::string hash = "hash";
415 418
416 content::MockDownloadItem item; 419 content::MockDownloadItem item;
417 EXPECT_CALL(item, AddObserver(_)); 420 EXPECT_CALL(item, AddObserver(_));
(...skipping 21 matching lines...) Expand all
439 } 442 }
440 443
441 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) { 444 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
442 ClientDownloadResponse response; 445 ClientDownloadResponse response;
443 response.set_verdict(ClientDownloadResponse::SAFE); 446 response.set_verdict(ClientDownloadResponse::SAFE);
444 net::FakeURLFetcherFactory factory(NULL); 447 net::FakeURLFetcherFactory factory(NULL);
445 // Empty response means SAFE. 448 // Empty response means SAFE.
446 factory.SetFakeResponse( 449 factory.SetFakeResponse(
447 DownloadProtectionService::GetDownloadRequestUrl(), 450 DownloadProtectionService::GetDownloadRequestUrl(),
448 response.SerializeAsString(), 451 response.SerializeAsString(),
449 true); 452 net::HTTP_OK);
450 453
451 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); 454 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
452 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); 455 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
453 std::vector<GURL> url_chain; 456 std::vector<GURL> url_chain;
454 url_chain.push_back(GURL("http://www.evil.com/a.exe")); 457 url_chain.push_back(GURL("http://www.evil.com/a.exe"));
455 GURL referrer("http://www.google.com/"); 458 GURL referrer("http://www.google.com/");
456 std::string hash = "hash"; 459 std::string hash = "hash";
457 460
458 content::MockDownloadItem item; 461 content::MockDownloadItem item;
459 EXPECT_CALL(item, AddObserver(_)).Times(6); 462 EXPECT_CALL(item, AddObserver(_)).Times(6);
(...skipping 17 matching lines...) Expand all
477 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 480 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
478 base::Unretained(this))); 481 base::Unretained(this)));
479 MessageLoop::current()->Run(); 482 MessageLoop::current()->Run();
480 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 483 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
481 484
482 // Invalid response should be safe too. 485 // Invalid response should be safe too.
483 response.Clear(); 486 response.Clear();
484 factory.SetFakeResponse( 487 factory.SetFakeResponse(
485 DownloadProtectionService::GetDownloadRequestUrl(), 488 DownloadProtectionService::GetDownloadRequestUrl(),
486 response.SerializePartialAsString(), 489 response.SerializePartialAsString(),
487 true); 490 net::HTTP_OK);
488 491
489 download_service_->CheckClientDownload( 492 download_service_->CheckClientDownload(
490 &item, 493 &item,
491 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 494 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
492 base::Unretained(this))); 495 base::Unretained(this)));
493 MessageLoop::current()->Run(); 496 MessageLoop::current()->Run();
494 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 497 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
495 std::string feedback_ping; 498 std::string feedback_ping;
496 std::string feedback_response; 499 std::string feedback_response;
497 EXPECT_FALSE(DownloadFeedbackService::GetPingsForDownloadForTesting( 500 EXPECT_FALSE(DownloadFeedbackService::GetPingsForDownloadForTesting(
498 item, &feedback_ping, &feedback_response)); 501 item, &feedback_ping, &feedback_response));
499 502
500 // If the response is dangerous the result should also be marked as dangerous. 503 // If the response is dangerous the result should also be marked as dangerous.
501 response.set_verdict(ClientDownloadResponse::DANGEROUS); 504 response.set_verdict(ClientDownloadResponse::DANGEROUS);
502 factory.SetFakeResponse( 505 factory.SetFakeResponse(
503 DownloadProtectionService::GetDownloadRequestUrl(), 506 DownloadProtectionService::GetDownloadRequestUrl(),
504 response.SerializeAsString(), 507 response.SerializeAsString(),
505 true); 508 net::HTTP_OK);
506 509
507 download_service_->CheckClientDownload( 510 download_service_->CheckClientDownload(
508 &item, 511 &item,
509 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 512 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
510 base::Unretained(this))); 513 base::Unretained(this)));
511 MessageLoop::current()->Run(); 514 MessageLoop::current()->Run();
512 EXPECT_FALSE(DownloadFeedbackService::GetPingsForDownloadForTesting( 515 EXPECT_FALSE(DownloadFeedbackService::GetPingsForDownloadForTesting(
513 item, &feedback_ping, &feedback_response)); 516 item, &feedback_ping, &feedback_response));
514 #if defined(OS_WIN) 517 #if defined(OS_WIN)
515 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); 518 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS));
516 #else 519 #else
517 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 520 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
518 #endif 521 #endif
519 522
520 // If the response is uncommon the result should also be marked as uncommon. 523 // If the response is uncommon the result should also be marked as uncommon.
521 response.set_verdict(ClientDownloadResponse::UNCOMMON); 524 response.set_verdict(ClientDownloadResponse::UNCOMMON);
522 factory.SetFakeResponse( 525 factory.SetFakeResponse(
523 DownloadProtectionService::GetDownloadRequestUrl(), 526 DownloadProtectionService::GetDownloadRequestUrl(),
524 response.SerializeAsString(), 527 response.SerializeAsString(),
525 true); 528 net::HTTP_OK);
526 529
527 download_service_->CheckClientDownload( 530 download_service_->CheckClientDownload(
528 &item, 531 &item,
529 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 532 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
530 base::Unretained(this))); 533 base::Unretained(this)));
531 MessageLoop::current()->Run(); 534 MessageLoop::current()->Run();
532 #if defined(OS_WIN) 535 #if defined(OS_WIN)
533 EXPECT_TRUE(IsResult(DownloadProtectionService::UNCOMMON)); 536 EXPECT_TRUE(IsResult(DownloadProtectionService::UNCOMMON));
534 EXPECT_TRUE(DownloadFeedbackService::GetPingsForDownloadForTesting( 537 EXPECT_TRUE(DownloadFeedbackService::GetPingsForDownloadForTesting(
535 item, &feedback_ping, &feedback_response)); 538 item, &feedback_ping, &feedback_response));
536 ClientDownloadRequest decoded_request; 539 ClientDownloadRequest decoded_request;
537 EXPECT_TRUE(decoded_request.ParseFromString(feedback_ping)); 540 EXPECT_TRUE(decoded_request.ParseFromString(feedback_ping));
538 EXPECT_EQ(url_chain.back().spec(), decoded_request.url()); 541 EXPECT_EQ(url_chain.back().spec(), decoded_request.url());
539 EXPECT_EQ(response.SerializeAsString(), feedback_response); 542 EXPECT_EQ(response.SerializeAsString(), feedback_response);
540 #else 543 #else
541 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 544 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
542 #endif 545 #endif
543 546
544 // If the response is dangerous_host the result should also be marked as 547 // If the response is dangerous_host the result should also be marked as
545 // dangerous_host. 548 // dangerous_host.
546 response.set_verdict(ClientDownloadResponse::DANGEROUS_HOST); 549 response.set_verdict(ClientDownloadResponse::DANGEROUS_HOST);
547 factory.SetFakeResponse( 550 factory.SetFakeResponse(
548 DownloadProtectionService::GetDownloadRequestUrl(), 551 DownloadProtectionService::GetDownloadRequestUrl(),
549 response.SerializeAsString(), 552 response.SerializeAsString(),
550 true); 553 net::HTTP_OK);
551 554
552 download_service_->CheckClientDownload( 555 download_service_->CheckClientDownload(
553 &item, 556 &item,
554 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 557 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
555 base::Unretained(this))); 558 base::Unretained(this)));
556 MessageLoop::current()->Run(); 559 MessageLoop::current()->Run();
557 #if defined(OS_WIN) 560 #if defined(OS_WIN)
558 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS_HOST)); 561 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS_HOST));
559 EXPECT_TRUE(DownloadFeedbackService::GetPingsForDownloadForTesting( 562 EXPECT_TRUE(DownloadFeedbackService::GetPingsForDownloadForTesting(
560 item, &feedback_ping, &feedback_response)); 563 item, &feedback_ping, &feedback_response));
561 EXPECT_EQ(response.SerializeAsString(), feedback_response); 564 EXPECT_EQ(response.SerializeAsString(), feedback_response);
562 #else 565 #else
563 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 566 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
564 #endif 567 #endif
565 568
566 // If the response is POTENTIALLY_UNWANTED the result should also be marked as 569 // If the response is POTENTIALLY_UNWANTED the result should also be marked as
567 // POTENTIALLY_UNWANTED. 570 // POTENTIALLY_UNWANTED.
568 response.set_verdict(ClientDownloadResponse::POTENTIALLY_UNWANTED); 571 response.set_verdict(ClientDownloadResponse::POTENTIALLY_UNWANTED);
569 factory.SetFakeResponse( 572 factory.SetFakeResponse(
570 DownloadProtectionService::GetDownloadRequestUrl(), 573 DownloadProtectionService::GetDownloadRequestUrl(),
571 response.SerializeAsString(), 574 response.SerializeAsString(),
572 true); 575 net::HTTP_OK);
573 576
574 download_service_->CheckClientDownload( 577 download_service_->CheckClientDownload(
575 &item, 578 &item,
576 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 579 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
577 base::Unretained(this))); 580 base::Unretained(this)));
578 MessageLoop::current()->Run(); 581 MessageLoop::current()->Run();
579 #if defined(OS_WIN) 582 #if defined(OS_WIN)
580 EXPECT_TRUE(IsResult(DownloadProtectionService::POTENTIALLY_UNWANTED)); 583 EXPECT_TRUE(IsResult(DownloadProtectionService::POTENTIALLY_UNWANTED));
581 #else 584 #else
582 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 585 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
583 #endif 586 #endif
584 } 587 }
585 588
586 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) { 589 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) {
587 ClientDownloadResponse response; 590 ClientDownloadResponse response;
588 response.set_verdict(ClientDownloadResponse::DANGEROUS); 591 response.set_verdict(ClientDownloadResponse::DANGEROUS);
589 net::FakeURLFetcherFactory factory(NULL); 592 net::FakeURLFetcherFactory factory(NULL);
590 factory.SetFakeResponse( 593 factory.SetFakeResponse(
591 DownloadProtectionService::GetDownloadRequestUrl(), 594 DownloadProtectionService::GetDownloadRequestUrl(),
592 response.SerializeAsString(), 595 response.SerializeAsString(),
593 true); 596 net::HTTP_OK);
594 597
595 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); 598 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
596 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); 599 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe"));
597 std::vector<GURL> url_chain; 600 std::vector<GURL> url_chain;
598 url_chain.push_back(GURL("http://www.evil.com/a.exe")); 601 url_chain.push_back(GURL("http://www.evil.com/a.exe"));
599 GURL referrer("http://www.google.com/"); 602 GURL referrer("http://www.google.com/");
600 std::string hash = "hash"; 603 std::string hash = "hash";
601 604
602 content::MockDownloadItem item; 605 content::MockDownloadItem item;
603 EXPECT_CALL(item, AddObserver(_)).Times(1); 606 EXPECT_CALL(item, AddObserver(_)).Times(1);
(...skipping 25 matching lines...) Expand all
629 } 632 }
630 633
631 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) { 634 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadZip) {
632 ClientDownloadResponse response; 635 ClientDownloadResponse response;
633 response.set_verdict(ClientDownloadResponse::SAFE); 636 response.set_verdict(ClientDownloadResponse::SAFE);
634 net::FakeURLFetcherFactory factory(NULL); 637 net::FakeURLFetcherFactory factory(NULL);
635 // Empty response means SAFE. 638 // Empty response means SAFE.
636 factory.SetFakeResponse( 639 factory.SetFakeResponse(
637 DownloadProtectionService::GetDownloadRequestUrl(), 640 DownloadProtectionService::GetDownloadRequestUrl(),
638 response.SerializeAsString(), 641 response.SerializeAsString(),
639 true); 642 net::HTTP_OK);
640 643
641 base::ScopedTempDir download_dir; 644 base::ScopedTempDir download_dir;
642 ASSERT_TRUE(download_dir.CreateUniqueTempDir()); 645 ASSERT_TRUE(download_dir.CreateUniqueTempDir());
643 646
644 base::FilePath a_tmp(download_dir.path().Append(FILE_PATH_LITERAL("a.tmp"))); 647 base::FilePath a_tmp(download_dir.path().Append(FILE_PATH_LITERAL("a.tmp")));
645 base::FilePath a_zip(FILE_PATH_LITERAL("a.zip")); 648 base::FilePath a_zip(FILE_PATH_LITERAL("a.zip"));
646 std::vector<GURL> url_chain; 649 std::vector<GURL> url_chain;
647 url_chain.push_back(GURL("http://www.evil.com/a.zip")); 650 url_chain.push_back(GURL("http://www.evil.com/a.zip"));
648 GURL referrer("http://www.google.com/"); 651 GURL referrer("http://www.google.com/");
649 std::string hash = "hash"; 652 std::string hash = "hash";
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 MessageLoop::current()->Run(); 699 MessageLoop::current()->Run();
697 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 700 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
698 Mock::VerifyAndClearExpectations(signature_util_.get()); 701 Mock::VerifyAndClearExpectations(signature_util_.get());
699 702
700 // If the response is dangerous the result should also be marked as 703 // If the response is dangerous the result should also be marked as
701 // dangerous. 704 // dangerous.
702 response.set_verdict(ClientDownloadResponse::DANGEROUS); 705 response.set_verdict(ClientDownloadResponse::DANGEROUS);
703 factory.SetFakeResponse( 706 factory.SetFakeResponse(
704 DownloadProtectionService::GetDownloadRequestUrl(), 707 DownloadProtectionService::GetDownloadRequestUrl(),
705 response.SerializeAsString(), 708 response.SerializeAsString(),
706 true); 709 net::HTTP_OK);
707 710
708 download_service_->CheckClientDownload( 711 download_service_->CheckClientDownload(
709 &item, 712 &item,
710 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 713 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
711 base::Unretained(this))); 714 base::Unretained(this)));
712 MessageLoop::current()->Run(); 715 MessageLoop::current()->Run();
713 #if defined(OS_WIN) 716 #if defined(OS_WIN)
714 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); 717 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS));
715 #else 718 #else
716 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); 719 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 ClientDownloadResponse response; 762 ClientDownloadResponse response;
760 // Even if the server verdict is dangerous we should return SAFE because 763 // Even if the server verdict is dangerous we should return SAFE because
761 // DownloadProtectionService::IsSupportedDownload() will return false 764 // DownloadProtectionService::IsSupportedDownload() will return false
762 // for crx downloads. 765 // for crx downloads.
763 response.set_verdict(ClientDownloadResponse::DANGEROUS); 766 response.set_verdict(ClientDownloadResponse::DANGEROUS);
764 net::FakeURLFetcherFactory factory(NULL); 767 net::FakeURLFetcherFactory factory(NULL);
765 // Empty response means SAFE. 768 // Empty response means SAFE.
766 factory.SetFakeResponse( 769 factory.SetFakeResponse(
767 DownloadProtectionService::GetDownloadRequestUrl(), 770 DownloadProtectionService::GetDownloadRequestUrl(),
768 response.SerializeAsString(), 771 response.SerializeAsString(),
769 true); 772 net::HTTP_OK);
770 773
771 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); 774 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp"));
772 base::FilePath a_crx(FILE_PATH_LITERAL("a.crx")); 775 base::FilePath a_crx(FILE_PATH_LITERAL("a.crx"));
773 std::vector<GURL> url_chain; 776 std::vector<GURL> url_chain;
774 url_chain.push_back(GURL("http://www.evil.com/a.crx")); 777 url_chain.push_back(GURL("http://www.evil.com/a.crx"));
775 GURL referrer("http://www.google.com/"); 778 GURL referrer("http://www.google.com/");
776 std::string hash = "hash"; 779 std::string hash = "hash";
777 780
778 content::MockDownloadItem item; 781 content::MockDownloadItem item;
779 EXPECT_CALL(item, AddObserver(_)).Times(1); 782 EXPECT_CALL(item, AddObserver(_)).Times(1);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); 1174 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit"));
1172 1175
1173 cert = ReadTestCertificate("test_c.pem"); 1176 cert = ReadTestCertificate("test_c.pem");
1174 ASSERT_TRUE(cert.get()); 1177 ASSERT_TRUE(cert.get());
1175 whitelist_strings.clear(); 1178 whitelist_strings.clear();
1176 GetCertificateWhitelistStrings( 1179 GetCertificateWhitelistStrings(
1177 *cert.get(), *issuer_cert.get(), &whitelist_strings); 1180 *cert.get(), *issuer_cert.get(), &whitelist_strings);
1178 EXPECT_THAT(whitelist_strings, ElementsAre()); 1181 EXPECT_THAT(whitelist_strings, ElementsAre());
1179 } 1182 }
1180 } // namespace safe_browsing 1183 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698