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

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

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | 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 // This test creates a fake safebrowsing service, where we can inject 5 // This test creates a fake safebrowsing service, where we can inject
6 // malware and phishing urls. It then uses a real browser to go to 6 // malware and phishing urls. It then uses a real browser to go to
7 // these urls, and sends "goback" or "proceed" commands and verifies 7 // these urls, and sends "goback" or "proceed" commands and verifies
8 // they work. 8 // they work.
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); 675 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
676 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); 676 EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
677 EXPECT_TRUE(Click("see-more-link")); 677 EXPECT_TRUE(Click("see-more-link"));
678 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); 678 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
679 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); 679 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
680 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); 680 EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
681 681
682 EXPECT_TRUE(ClickAndWaitForDetach("back")); 682 EXPECT_TRUE(ClickAndWaitForDetach("back"));
683 AssertNoInterstitial(false); // Assert the interstitial is gone 683 AssertNoInterstitial(false); // Assert the interstitial is gone
684 EXPECT_EQ( 684 EXPECT_EQ(
685 GURL(content::kAboutBlankURL), // Back to "about:blank" 685 GURL(url::kAboutBlankURL), // Back to "about:blank"
686 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 686 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
687 } 687 }
688 688
689 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) { 689 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
690 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); 690 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
691 691
692 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); 692 EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
693 AssertNoInterstitial(true); // Assert the interstitial is gone. 693 AssertNoInterstitial(true); // Assert the interstitial is gone.
694 EXPECT_EQ(url, 694 EXPECT_EQ(url,
695 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 695 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); 727 EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
728 EXPECT_TRUE(Click("see-more-link")); 728 EXPECT_TRUE(Click("see-more-link"));
729 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); 729 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
730 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); 730 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
731 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); 731 EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
732 732
733 EXPECT_TRUE(ClickAndWaitForDetach("back")); 733 EXPECT_TRUE(ClickAndWaitForDetach("back"));
734 AssertNoInterstitial(false); // Assert the interstitial is gone 734 AssertNoInterstitial(false); // Assert the interstitial is gone
735 735
736 EXPECT_EQ( 736 EXPECT_EQ(
737 GURL(content::kAboutBlankURL), // Back to "about:blank" 737 GURL(url::kAboutBlankURL), // Back to "about:blank"
738 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 738 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
739 } 739 }
740 740
741 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) { 741 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) {
742 GURL url = SetupMalwareIframeWarningAndNavigate(); 742 GURL url = SetupMalwareIframeWarningAndNavigate();
743 743
744 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); 744 EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
745 AssertNoInterstitial(true); // Assert the interstitial is gone 745 AssertNoInterstitial(true); // Assert the interstitial is gone
746 746
747 EXPECT_EQ(url, 747 EXPECT_EQ(url,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); 816 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
817 EXPECT_TRUE(Click("see-more-link")); 817 EXPECT_TRUE(Click("see-more-link"));
818 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); 818 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
819 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); 819 EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
820 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); 820 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
821 821
822 // The "proceed" command should go back instead, if proceeding is disabled. 822 // The "proceed" command should go back instead, if proceeding is disabled.
823 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); 823 EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
824 AssertNoInterstitial(true); 824 AssertNoInterstitial(true);
825 EXPECT_EQ( 825 EXPECT_EQ(
826 GURL(content::kAboutBlankURL), // Back to "about:blank" 826 GURL(url::kAboutBlankURL), // Back to "about:blank"
827 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 827 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
828 } 828 }
829 829
830 // Verifies that the reporting checkbox is hidden on non-HTTP pages. 830 // Verifies that the reporting checkbox is hidden on non-HTTP pages.
831 // TODO(mattm): Should also verify that no report is sent, but there isn't a 831 // TODO(mattm): Should also verify that no report is sent, but there isn't a
832 // good way to do that in the current design. 832 // good way to do that in the current design.
833 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { 833 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) {
834 #if defined(OS_WIN) && defined(USE_ASH) 834 #if defined(OS_WIN) && defined(USE_ASH)
835 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 835 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
836 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 836 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
(...skipping 15 matching lines...) Expand all
852 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); 852 EXPECT_EQ(HIDDEN, GetVisibility("check-report"));
853 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); 853 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
854 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); 854 EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
855 EXPECT_TRUE(Click("see-more-link")); 855 EXPECT_TRUE(Click("see-more-link"));
856 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); 856 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
857 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); 857 EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
858 858
859 EXPECT_TRUE(ClickAndWaitForDetach("back")); 859 EXPECT_TRUE(ClickAndWaitForDetach("back"));
860 AssertNoInterstitial(false); // Assert the interstitial is gone 860 AssertNoInterstitial(false); // Assert the interstitial is gone
861 EXPECT_EQ( 861 EXPECT_EQ(
862 GURL(content::kAboutBlankURL), // Back to "about:blank" 862 GURL(url::kAboutBlankURL), // Back to "about:blank"
863 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 863 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
864 } 864 }
865 865
866 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) { 866 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
867 #if defined(OS_WIN) && defined(USE_ASH) 867 #if defined(OS_WIN) && defined(USE_ASH)
868 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 868 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
869 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 869 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
870 return; 870 return;
871 #endif 871 #endif
872 872
873 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); 873 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
874 874
875 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon")); 875 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon"));
876 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon")); 876 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon"));
877 EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon")); 877 EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon"));
878 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); 878 EXPECT_EQ(HIDDEN, GetVisibility("check-report"));
879 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); 879 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
880 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); 880 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
881 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); 881 EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
882 EXPECT_TRUE(Click("see-more-link")); 882 EXPECT_TRUE(Click("see-more-link"));
883 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); 883 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
884 EXPECT_EQ(VISIBLE, GetVisibility("report-error-link")); 884 EXPECT_EQ(VISIBLE, GetVisibility("report-error-link"));
885 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); 885 EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
886 886
887 EXPECT_TRUE(ClickAndWaitForDetach("back")); 887 EXPECT_TRUE(ClickAndWaitForDetach("back"));
888 AssertNoInterstitial(false); // Assert the interstitial is gone 888 AssertNoInterstitial(false); // Assert the interstitial is gone
889 EXPECT_EQ( 889 EXPECT_EQ(
890 GURL(content::kAboutBlankURL), // We are back to "about:blank". 890 GURL(url::kAboutBlankURL), // We are back to "about:blank".
891 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 891 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
892 } 892 }
893 893
894 // http://crbug.com/247763 894 // http://crbug.com/247763
895 #if defined(OS_WIN) 895 #if defined(OS_WIN)
896 // Temporarily re-enabled to get some logs. 896 // Temporarily re-enabled to get some logs.
897 #define MAYBE_PhishingProceed PhishingProceed 897 #define MAYBE_PhishingProceed PhishingProceed
898 #else 898 #else
899 #define MAYBE_PhishingProceed PhishingProceed 899 #define MAYBE_PhishingProceed PhishingProceed
900 #endif 900 #endif
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 LOG(INFO) << "2"; 940 LOG(INFO) << "2";
941 AssertNoInterstitial(false); // Assert the interstitial is gone 941 AssertNoInterstitial(false); // Assert the interstitial is gone
942 942
943 LOG(INFO) << "3"; 943 LOG(INFO) << "3";
944 // We are in the help page. 944 // We are in the help page.
945 EXPECT_EQ( 945 EXPECT_EQ(
946 "/transparencyreport/safebrowsing/", 946 "/transparencyreport/safebrowsing/",
947 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); 947 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
948 LOG(INFO) << "4"; 948 LOG(INFO) << "4";
949 } 949 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698