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

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

Issue 2603433002: Move SecurityInterstitialPage into component (Closed)
Patch Set: missed some changes in rebase Created 3 years, 11 months 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
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 <list> 5 #include <list>
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/interstitials/chrome_controller_client.h" 8 #include "chrome/browser/interstitials/chrome_controller_client.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 SetExtendedReportingPref(profile->GetPrefs(), false); 630 SetExtendedReportingPref(profile->GetPrefs(), false);
631 631
632 // Start a load. 632 // Start a load.
633 controller().LoadURL(GURL(kBadURL), content::Referrer(), 633 controller().LoadURL(GURL(kBadURL), content::Referrer(),
634 ui::PAGE_TRANSITION_TYPED, std::string()); 634 ui::PAGE_TRANSITION_TYPED, std::string());
635 635
636 // Simulate the load causing a safe browsing interstitial to be shown. 636 // Simulate the load causing a safe browsing interstitial to be shown.
637 ShowInterstitial(false, kBadURL); 637 ShowInterstitial(false, kBadURL);
638 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); 638 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
639 ASSERT_TRUE(sb_interstitial); 639 ASSERT_TRUE(sb_interstitial);
640 EXPECT_TRUE(sb_interstitial->CanShowExtendedReportingOption()); 640 EXPECT_TRUE(sb_interstitial->sb_error_ui_->CanShowExtendedReportingOption());
641 641
642 base::RunLoop().RunUntilIdle(); 642 base::RunLoop().RunUntilIdle();
643 643
644 // Simulate the user clicking "don't proceed". 644 // Simulate the user clicking "don't proceed".
645 DontProceedThroughInterstitial(sb_interstitial); 645 DontProceedThroughInterstitial(sb_interstitial);
646 646
647 // The interstitial should be gone. 647 // The interstitial should be gone.
648 EXPECT_EQ(CANCEL, user_response()); 648 EXPECT_EQ(CANCEL, user_response());
649 EXPECT_FALSE(GetSafeBrowsingBlockingPage()); 649 EXPECT_FALSE(GetSafeBrowsingBlockingPage());
650 650
(...skipping 13 matching lines...) Expand all
664 SetExtendedReportingPref(profile->GetPrefs(), false); 664 SetExtendedReportingPref(profile->GetPrefs(), false);
665 665
666 // Start a load. 666 // Start a load.
667 controller().LoadURL(GURL(kBadURL), content::Referrer(), 667 controller().LoadURL(GURL(kBadURL), content::Referrer(),
668 ui::PAGE_TRANSITION_TYPED, std::string()); 668 ui::PAGE_TRANSITION_TYPED, std::string());
669 669
670 // Simulate the load causing a safe browsing interstitial to be shown. 670 // Simulate the load causing a safe browsing interstitial to be shown.
671 ShowInterstitial(false, kBadURL); 671 ShowInterstitial(false, kBadURL);
672 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); 672 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
673 ASSERT_TRUE(sb_interstitial); 673 ASSERT_TRUE(sb_interstitial);
674 EXPECT_TRUE(sb_interstitial->CanShowExtendedReportingOption()); 674 EXPECT_TRUE(sb_interstitial->sb_error_ui_->CanShowExtendedReportingOption());
675 675
676 base::RunLoop().RunUntilIdle(); 676 base::RunLoop().RunUntilIdle();
677 677
678 EXPECT_FALSE(IsExtendedReportingEnabled(*profile->GetPrefs())); 678 EXPECT_FALSE(IsExtendedReportingEnabled(*profile->GetPrefs()));
679 679
680 // Simulate the user check the report agreement checkbox. 680 // Simulate the user check the report agreement checkbox.
681 sb_interstitial->controller()->SetReportingPreference(true); 681 sb_interstitial->controller()->SetReportingPreference(true);
682 682
683 EXPECT_TRUE(IsExtendedReportingEnabled(*profile->GetPrefs())); 683 EXPECT_TRUE(IsExtendedReportingEnabled(*profile->GetPrefs()));
684 684
(...skipping 15 matching lines...) Expand all
700 SetExtendedReportingPref(profile->GetPrefs(), true); 700 SetExtendedReportingPref(profile->GetPrefs(), true);
701 701
702 // Start a load. 702 // Start a load.
703 controller().LoadURL(GURL(kBadURL), content::Referrer(), 703 controller().LoadURL(GURL(kBadURL), content::Referrer(),
704 ui::PAGE_TRANSITION_TYPED, std::string()); 704 ui::PAGE_TRANSITION_TYPED, std::string());
705 705
706 // Simulate the load causing a safe browsing interstitial to be shown. 706 // Simulate the load causing a safe browsing interstitial to be shown.
707 ShowInterstitial(false, kBadURL); 707 ShowInterstitial(false, kBadURL);
708 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); 708 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
709 ASSERT_TRUE(sb_interstitial); 709 ASSERT_TRUE(sb_interstitial);
710 EXPECT_FALSE(sb_interstitial->CanShowExtendedReportingOption()); 710 EXPECT_FALSE(sb_interstitial->sb_error_ui_->CanShowExtendedReportingOption());
711 711
712 base::RunLoop().RunUntilIdle(); 712 base::RunLoop().RunUntilIdle();
713 713
714 // Simulate the user clicking "don't proceed". 714 // Simulate the user clicking "don't proceed".
715 DontProceedThroughInterstitial(sb_interstitial); 715 DontProceedThroughInterstitial(sb_interstitial);
716 716
717 // The interstitial should be gone. 717 // The interstitial should be gone.
718 EXPECT_EQ(CANCEL, user_response()); 718 EXPECT_EQ(CANCEL, user_response());
719 EXPECT_FALSE(GetSafeBrowsingBlockingPage()); 719 EXPECT_FALSE(GetSafeBrowsingBlockingPage());
720 720
(...skipping 13 matching lines...) Expand all
734 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false); 734 prefs::kSafeBrowsingExtendedReportingOptInAllowed, false);
735 735
736 // Start a load. 736 // Start a load.
737 controller().LoadURL(GURL(kBadURL), content::Referrer(), 737 controller().LoadURL(GURL(kBadURL), content::Referrer(),
738 ui::PAGE_TRANSITION_TYPED, std::string()); 738 ui::PAGE_TRANSITION_TYPED, std::string());
739 739
740 // Simulate the load causing a safe browsing interstitial to be shown. 740 // Simulate the load causing a safe browsing interstitial to be shown.
741 ShowInterstitial(false, kBadURL); 741 ShowInterstitial(false, kBadURL);
742 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage(); 742 SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
743 ASSERT_TRUE(sb_interstitial); 743 ASSERT_TRUE(sb_interstitial);
744 EXPECT_FALSE(sb_interstitial->CanShowExtendedReportingOption()); 744 EXPECT_FALSE(sb_interstitial->sb_error_ui_->CanShowExtendedReportingOption());
745 745
746 base::RunLoop().RunUntilIdle(); 746 base::RunLoop().RunUntilIdle();
747 747
748 // Simulate the user clicking "don't proceed". 748 // Simulate the user clicking "don't proceed".
749 DontProceedThroughInterstitial(sb_interstitial); 749 DontProceedThroughInterstitial(sb_interstitial);
750 750
751 // The interstitial should be gone. 751 // The interstitial should be gone.
752 EXPECT_EQ(CANCEL, user_response()); 752 EXPECT_EQ(CANCEL, user_response());
753 EXPECT_FALSE(GetSafeBrowsingBlockingPage()); 753 EXPECT_FALSE(GetSafeBrowsingBlockingPage());
754 754
755 // No report should have been sent. 755 // No report should have been sent.
756 EXPECT_EQ(0u, ui_manager_->GetThreatDetails()->size()); 756 EXPECT_EQ(0u, ui_manager_->GetThreatDetails()->size());
757 ui_manager_->GetThreatDetails()->clear(); 757 ui_manager_->GetThreatDetails()->clear();
758 } 758 }
759 759
760 } // namespace safe_browsing 760 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc ('k') | chrome/browser/ssl/bad_clock_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698