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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 using ::testing::Invoke; | 40 using ::testing::Invoke; |
41 using ::testing::Ref; | 41 using ::testing::Ref; |
42 using ::testing::Return; | 42 using ::testing::Return; |
43 using ::testing::ReturnPointee; | 43 using ::testing::ReturnPointee; |
44 using ::testing::ReturnRef; | 44 using ::testing::ReturnRef; |
45 using ::testing::ReturnRefOfCopy; | 45 using ::testing::ReturnRefOfCopy; |
46 using ::testing::SetArgPointee; | 46 using ::testing::SetArgPointee; |
47 using ::testing::WithArg; | 47 using ::testing::WithArg; |
48 using ::testing::_; | 48 using ::testing::_; |
49 using content::DownloadItem; | 49 using content::DownloadItem; |
| 50 using safe_browsing::DownloadFileType; |
50 | 51 |
51 namespace { | 52 namespace { |
52 | 53 |
53 class MockWebContentsDelegate : public content::WebContentsDelegate { | 54 class MockWebContentsDelegate : public content::WebContentsDelegate { |
54 public: | 55 public: |
55 ~MockWebContentsDelegate() override {} | 56 ~MockWebContentsDelegate() override {} |
56 }; | 57 }; |
57 | 58 |
58 // Google Mock action that posts a task to the current message loop that invokes | 59 // Google Mock action that posts a task to the current message loop that invokes |
59 // the first argument of the mocked method as a callback. Said argument must be | 60 // the first argument of the mocked method as a callback. Said argument must be |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 Return(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT)); | 417 Return(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT)); |
417 | 418 |
418 { | 419 { |
419 const std::string kDangerousContentDisposition( | 420 const std::string kDangerousContentDisposition( |
420 "attachment; filename=\"foo.swf\""); | 421 "attachment; filename=\"foo.swf\""); |
421 EXPECT_CALL(*download_item, GetContentDisposition()) | 422 EXPECT_CALL(*download_item, GetContentDisposition()) |
422 .WillRepeatedly(Return(kDangerousContentDisposition)); | 423 .WillRepeatedly(Return(kDangerousContentDisposition)); |
423 DownloadTargetInfo target_info; | 424 DownloadTargetInfo target_info; |
424 DetermineDownloadTarget(download_item.get(), &target_info); | 425 DetermineDownloadTarget(download_item.get(), &target_info); |
425 | 426 |
426 EXPECT_EQ(download_util::DANGEROUS, | 427 EXPECT_EQ(DownloadFileType::DANGEROUS, |
427 DownloadItemModel(download_item.get()).GetDangerLevel()); | 428 DownloadItemModel(download_item.get()).GetDangerLevel()); |
428 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 429 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
429 target_info.danger_type); | 430 target_info.danger_type); |
430 } | 431 } |
431 | 432 |
432 { | 433 { |
433 const std::string kSafeContentDisposition( | 434 const std::string kSafeContentDisposition( |
434 "attachment; filename=\"foo.txt\""); | 435 "attachment; filename=\"foo.txt\""); |
435 EXPECT_CALL(*download_item, GetContentDisposition()) | 436 EXPECT_CALL(*download_item, GetContentDisposition()) |
436 .WillRepeatedly(Return(kSafeContentDisposition)); | 437 .WillRepeatedly(Return(kSafeContentDisposition)); |
437 DownloadTargetInfo target_info; | 438 DownloadTargetInfo target_info; |
438 DetermineDownloadTarget(download_item.get(), &target_info); | 439 DetermineDownloadTarget(download_item.get(), &target_info); |
439 EXPECT_EQ(download_util::NOT_DANGEROUS, | 440 EXPECT_EQ(DownloadFileType::NOT_DANGEROUS, |
440 DownloadItemModel(download_item.get()).GetDangerLevel()); | 441 DownloadItemModel(download_item.get()).GetDangerLevel()); |
441 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 442 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
442 target_info.danger_type); | 443 target_info.danger_type); |
443 } | 444 } |
444 | 445 |
445 { | 446 { |
446 const std::string kModerateContentDisposition( | 447 const std::string kModerateContentDisposition( |
447 "attachment; filename=\"foo.crx\""); | 448 "attachment; filename=\"foo.crx\""); |
448 EXPECT_CALL(*download_item, GetContentDisposition()) | 449 EXPECT_CALL(*download_item, GetContentDisposition()) |
449 .WillRepeatedly(Return(kModerateContentDisposition)); | 450 .WillRepeatedly(Return(kModerateContentDisposition)); |
450 DownloadTargetInfo target_info; | 451 DownloadTargetInfo target_info; |
451 DetermineDownloadTarget(download_item.get(), &target_info); | 452 DetermineDownloadTarget(download_item.get(), &target_info); |
452 EXPECT_EQ(download_util::ALLOW_ON_USER_GESTURE, | 453 EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE, |
453 DownloadItemModel(download_item.get()).GetDangerLevel()); | 454 DownloadItemModel(download_item.get()).GetDangerLevel()); |
454 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 455 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
455 target_info.danger_type); | 456 target_info.danger_type); |
456 } | 457 } |
457 } | 458 } |
458 | 459 |
459 TEST_F(ChromeDownloadManagerDelegateTest, CheckForFileExistence) { | 460 TEST_F(ChromeDownloadManagerDelegateTest, CheckForFileExistence) { |
460 const char kData[] = "helloworld"; | 461 const char kData[] = "helloworld"; |
461 const size_t kDataLength = sizeof(kData) - 1; | 462 const size_t kDataLength = sizeof(kData) - 1; |
462 base::FilePath existing_path = default_download_path().AppendASCII("foo"); | 463 base::FilePath existing_path = default_download_path().AppendASCII("foo"); |
(...skipping 11 matching lines...) Expand all Loading... |
474 EXPECT_CALL(*download_item, GetTargetFilePath()) | 475 EXPECT_CALL(*download_item, GetTargetFilePath()) |
475 .WillRepeatedly(ReturnRef(non_existent_path)); | 476 .WillRepeatedly(ReturnRef(non_existent_path)); |
476 EXPECT_FALSE(CheckForFileExistence(download_item.get())); | 477 EXPECT_FALSE(CheckForFileExistence(download_item.get())); |
477 } | 478 } |
478 | 479 |
479 #if defined(FULL_SAFE_BROWSING) | 480 #if defined(FULL_SAFE_BROWSING) |
480 namespace { | 481 namespace { |
481 | 482 |
482 struct SafeBrowsingTestParameters { | 483 struct SafeBrowsingTestParameters { |
483 content::DownloadDangerType initial_danger_type; | 484 content::DownloadDangerType initial_danger_type; |
484 download_util::DownloadDangerLevel initial_danger_level; | 485 DownloadFileType::DangerLevel initial_danger_level; |
485 safe_browsing::DownloadProtectionService::DownloadCheckResult verdict; | 486 safe_browsing::DownloadProtectionService::DownloadCheckResult verdict; |
486 | 487 |
487 content::DownloadDangerType expected_danger_type; | 488 content::DownloadDangerType expected_danger_type; |
488 }; | 489 }; |
489 | 490 |
490 class TestDownloadProtectionService | 491 class TestDownloadProtectionService |
491 : public safe_browsing::DownloadProtectionService { | 492 : public safe_browsing::DownloadProtectionService { |
492 public: | 493 public: |
493 TestDownloadProtectionService() : DownloadProtectionService(nullptr) {} | 494 TestDownloadProtectionService() : DownloadProtectionService(nullptr) {} |
494 | 495 |
(...skipping 28 matching lines...) Expand all Loading... |
523 .WillByDefault(Return(test_download_protection_service_.get())); | 524 .WillByDefault(Return(test_download_protection_service_.get())); |
524 } | 525 } |
525 | 526 |
526 void ChromeDownloadManagerDelegateTestWithSafeBrowsing::TearDown() { | 527 void ChromeDownloadManagerDelegateTestWithSafeBrowsing::TearDown() { |
527 test_download_protection_service_.reset(); | 528 test_download_protection_service_.reset(); |
528 ChromeDownloadManagerDelegateTest::TearDown(); | 529 ChromeDownloadManagerDelegateTest::TearDown(); |
529 } | 530 } |
530 | 531 |
531 const SafeBrowsingTestParameters kSafeBrowsingTestCases[] = { | 532 const SafeBrowsingTestParameters kSafeBrowsingTestCases[] = { |
532 // SAFE verdict for a safe file. | 533 // SAFE verdict for a safe file. |
533 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download_util::NOT_DANGEROUS, | 534 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 535 DownloadFileType::NOT_DANGEROUS, |
534 safe_browsing::DownloadProtectionService::SAFE, | 536 safe_browsing::DownloadProtectionService::SAFE, |
535 | 537 |
536 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, | 538 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, |
537 | 539 |
538 // UNKNOWN verdict for a safe file. | 540 // UNKNOWN verdict for a safe file. |
539 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download_util::NOT_DANGEROUS, | 541 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 542 DownloadFileType::NOT_DANGEROUS, |
540 safe_browsing::DownloadProtectionService::UNKNOWN, | 543 safe_browsing::DownloadProtectionService::UNKNOWN, |
541 | 544 |
542 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, | 545 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, |
543 | 546 |
544 // DANGEROUS verdict for a safe file. | 547 // DANGEROUS verdict for a safe file. |
545 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download_util::NOT_DANGEROUS, | 548 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 549 DownloadFileType::NOT_DANGEROUS, |
546 safe_browsing::DownloadProtectionService::DANGEROUS, | 550 safe_browsing::DownloadProtectionService::DANGEROUS, |
547 | 551 |
548 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, | 552 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, |
549 | 553 |
550 // UNCOMMON verdict for a safe file. | 554 // UNCOMMON verdict for a safe file. |
551 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download_util::NOT_DANGEROUS, | 555 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 556 DownloadFileType::NOT_DANGEROUS, |
552 safe_browsing::DownloadProtectionService::UNCOMMON, | 557 safe_browsing::DownloadProtectionService::UNCOMMON, |
553 | 558 |
554 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, | 559 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, |
555 | 560 |
556 // POTENTIALLY_UNWANTED verdict for a safe file. | 561 // POTENTIALLY_UNWANTED verdict for a safe file. |
557 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, download_util::NOT_DANGEROUS, | 562 {content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, |
| 563 DownloadFileType::NOT_DANGEROUS, |
558 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, | 564 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, |
559 | 565 |
560 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, | 566 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, |
561 | 567 |
562 // SAFE verdict for a potentially dangerous file. | 568 // SAFE verdict for a potentially dangerous file. |
563 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 569 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
564 download_util::ALLOW_ON_USER_GESTURE, | 570 DownloadFileType::ALLOW_ON_USER_GESTURE, |
565 safe_browsing::DownloadProtectionService::SAFE, | 571 safe_browsing::DownloadProtectionService::SAFE, |
566 | 572 |
567 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, | 573 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS}, |
568 | 574 |
569 // UNKNOWN verdict for a potentially dangerous file. | 575 // UNKNOWN verdict for a potentially dangerous file. |
570 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 576 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
571 download_util::ALLOW_ON_USER_GESTURE, | 577 DownloadFileType::ALLOW_ON_USER_GESTURE, |
572 safe_browsing::DownloadProtectionService::UNKNOWN, | 578 safe_browsing::DownloadProtectionService::UNKNOWN, |
573 | 579 |
574 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, | 580 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, |
575 | 581 |
576 // DANGEROUS verdict for a potentially dangerous file. | 582 // DANGEROUS verdict for a potentially dangerous file. |
577 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 583 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
578 download_util::ALLOW_ON_USER_GESTURE, | 584 DownloadFileType::ALLOW_ON_USER_GESTURE, |
579 safe_browsing::DownloadProtectionService::DANGEROUS, | 585 safe_browsing::DownloadProtectionService::DANGEROUS, |
580 | 586 |
581 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, | 587 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, |
582 | 588 |
583 // UNCOMMON verdict for a potentially dangerous file. | 589 // UNCOMMON verdict for a potentially dangerous file. |
584 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 590 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
585 download_util::ALLOW_ON_USER_GESTURE, | 591 DownloadFileType::ALLOW_ON_USER_GESTURE, |
586 safe_browsing::DownloadProtectionService::UNCOMMON, | 592 safe_browsing::DownloadProtectionService::UNCOMMON, |
587 | 593 |
588 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, | 594 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, |
589 | 595 |
590 // POTENTIALLY_UNWANTED verdict for a potentially dangerous file. | 596 // POTENTIALLY_UNWANTED verdict for a potentially dangerous file. |
591 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 597 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
592 download_util::ALLOW_ON_USER_GESTURE, | 598 DownloadFileType::ALLOW_ON_USER_GESTURE, |
593 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, | 599 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, |
594 | 600 |
595 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, | 601 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, |
596 | 602 |
597 // SAFE verdict for a dangerous file. | 603 // SAFE verdict for a dangerous file. |
598 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 604 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
599 download_util::DANGEROUS, safe_browsing::DownloadProtectionService::SAFE, | 605 DownloadFileType::DANGEROUS, |
| 606 safe_browsing::DownloadProtectionService::SAFE, |
600 | 607 |
601 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, | 608 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, |
602 | 609 |
603 // UNKNOWN verdict for a dangerous file. | 610 // UNKNOWN verdict for a dangerous file. |
604 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 611 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
605 download_util::DANGEROUS, | 612 DownloadFileType::DANGEROUS, |
606 safe_browsing::DownloadProtectionService::UNKNOWN, | 613 safe_browsing::DownloadProtectionService::UNKNOWN, |
607 | 614 |
608 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, | 615 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE}, |
609 | 616 |
610 // DANGEROUS verdict for a dangerous file. | 617 // DANGEROUS verdict for a dangerous file. |
611 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 618 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
612 download_util::DANGEROUS, | 619 DownloadFileType::DANGEROUS, |
613 safe_browsing::DownloadProtectionService::DANGEROUS, | 620 safe_browsing::DownloadProtectionService::DANGEROUS, |
614 | 621 |
615 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, | 622 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT}, |
616 | 623 |
617 // UNCOMMON verdict for a dangerous file. | 624 // UNCOMMON verdict for a dangerous file. |
618 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 625 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
619 download_util::DANGEROUS, | 626 DownloadFileType::DANGEROUS, |
620 safe_browsing::DownloadProtectionService::UNCOMMON, | 627 safe_browsing::DownloadProtectionService::UNCOMMON, |
621 | 628 |
622 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, | 629 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT}, |
623 | 630 |
624 // POTENTIALLY_UNWANTED verdict for a dangerous file. | 631 // POTENTIALLY_UNWANTED verdict for a dangerous file. |
625 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, | 632 {content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, |
626 download_util::DANGEROUS, | 633 DownloadFileType::DANGEROUS, |
627 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, | 634 safe_browsing::DownloadProtectionService::POTENTIALLY_UNWANTED, |
628 | 635 |
629 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, | 636 content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED}, |
630 }; | 637 }; |
631 | 638 |
632 INSTANTIATE_TEST_CASE_P(_, | 639 INSTANTIATE_TEST_CASE_P(_, |
633 ChromeDownloadManagerDelegateTestWithSafeBrowsing, | 640 ChromeDownloadManagerDelegateTestWithSafeBrowsing, |
634 ::testing::ValuesIn(kSafeBrowsingTestCases)); | 641 ::testing::ValuesIn(kSafeBrowsingTestCases)); |
635 | 642 |
636 } // namespace | 643 } // namespace |
637 | 644 |
638 TEST_P(ChromeDownloadManagerDelegateTestWithSafeBrowsing, CheckClientDownload) { | 645 TEST_P(ChromeDownloadManagerDelegateTestWithSafeBrowsing, CheckClientDownload) { |
639 const SafeBrowsingTestParameters& kParameters = GetParam(); | 646 const SafeBrowsingTestParameters& kParameters = GetParam(); |
640 | 647 |
641 std::unique_ptr<content::MockDownloadItem> download_item = | 648 std::unique_ptr<content::MockDownloadItem> download_item = |
642 CreateActiveDownloadItem(0); | 649 CreateActiveDownloadItem(0); |
643 EXPECT_CALL(*delegate(), GetDownloadProtectionService()); | 650 EXPECT_CALL(*delegate(), GetDownloadProtectionService()); |
644 EXPECT_CALL(*download_protection_service(), MockCheckClientDownload()) | 651 EXPECT_CALL(*download_protection_service(), MockCheckClientDownload()) |
645 .WillOnce(Return(kParameters.verdict)); | 652 .WillOnce(Return(kParameters.verdict)); |
646 EXPECT_CALL(*download_item, GetDangerType()) | 653 EXPECT_CALL(*download_item, GetDangerType()) |
647 .WillRepeatedly(Return(kParameters.initial_danger_type)); | 654 .WillRepeatedly(Return(kParameters.initial_danger_type)); |
648 | 655 |
649 if (kParameters.initial_danger_level != download_util::NOT_DANGEROUS) { | 656 if (kParameters.initial_danger_level != DownloadFileType::NOT_DANGEROUS) { |
650 DownloadItemModel(download_item.get()) | 657 DownloadItemModel(download_item.get()) |
651 .SetDangerLevel(kParameters.initial_danger_level); | 658 .SetDangerLevel(kParameters.initial_danger_level); |
652 } | 659 } |
653 | 660 |
654 if (kParameters.expected_danger_type != | 661 if (kParameters.expected_danger_type != |
655 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { | 662 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { |
656 EXPECT_CALL(*download_item, | 663 EXPECT_CALL(*download_item, |
657 OnContentCheckCompleted(kParameters.expected_danger_type)); | 664 OnContentCheckCompleted(kParameters.expected_danger_type)); |
658 } else { | 665 } else { |
659 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); | 666 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); |
660 } | 667 } |
661 | 668 |
662 base::RunLoop run_loop; | 669 base::RunLoop run_loop; |
663 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), | 670 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), |
664 run_loop.QuitClosure())); | 671 run_loop.QuitClosure())); |
665 run_loop.Run(); | 672 run_loop.Run(); |
666 } | 673 } |
667 | 674 |
668 #endif // FULL_SAFE_BROWSING | 675 #endif // FULL_SAFE_BROWSING |
OLD | NEW |