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 // 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 } | 627 } |
628 | 628 |
629 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, | 629 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, |
630 HarmfulDontProceed) { | 630 HarmfulDontProceed) { |
631 #if defined(OS_WIN) && defined(USE_ASH) | 631 #if defined(OS_WIN) && defined(USE_ASH) |
632 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 632 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
633 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 633 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
634 return; | 634 return; |
635 #endif | 635 #endif |
636 | 636 |
637 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_HARMFUL); | 637 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_UNWANTED); |
638 | 638 |
639 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); | 639 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); |
640 EXPECT_EQ(HIDDEN, GetVisibility("details")); | 640 EXPECT_EQ(HIDDEN, GetVisibility("details")); |
641 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); | 641 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
642 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); | 642 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
643 EXPECT_TRUE(Click("details-button")); | 643 EXPECT_TRUE(Click("details-button")); |
644 EXPECT_EQ(VISIBLE, GetVisibility("details")); | 644 EXPECT_EQ(VISIBLE, GetVisibility("details")); |
645 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); | 645 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); |
646 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); | 646 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
647 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); | 647 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); |
648 | 648 |
649 AssertNoInterstitial(false); // Assert the interstitial is gone | 649 AssertNoInterstitial(false); // Assert the interstitial is gone |
650 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" | 650 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" |
651 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 651 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
652 } | 652 } |
653 | 653 |
654 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) { | 654 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) { |
655 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); | 655 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); |
656 | 656 |
657 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); | 657 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); |
658 AssertNoInterstitial(true); // Assert the interstitial is gone. | 658 AssertNoInterstitial(true); // Assert the interstitial is gone. |
659 EXPECT_EQ(url, | 659 EXPECT_EQ(url, |
660 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 660 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
661 } | 661 } |
662 | 662 |
663 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, HarmfulProceed) { | 663 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, HarmfulProceed) { |
664 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_HARMFUL); | 664 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_UNWANTED); |
665 | 665 |
666 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); | 666 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); |
667 AssertNoInterstitial(true); // Assert the interstitial is gone. | 667 AssertNoInterstitial(true); // Assert the interstitial is gone. |
668 EXPECT_EQ(url, | 668 EXPECT_EQ(url, |
669 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 669 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
670 } | 670 } |
671 | 671 |
672 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, | 672 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, |
673 MalwareIframeDontProceed) { | 673 MalwareIframeDontProceed) { |
674 #if defined(OS_WIN) && defined(USE_ASH) | 674 #if defined(OS_WIN) && defined(USE_ASH) |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, PhishingLearnMore) { | 837 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, PhishingLearnMore) { |
838 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 838 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
839 EXPECT_TRUE(ClickAndWaitForDetach("help-link")); | 839 EXPECT_TRUE(ClickAndWaitForDetach("help-link")); |
840 AssertNoInterstitial(false); // Assert the interstitial is gone | 840 AssertNoInterstitial(false); // Assert the interstitial is gone |
841 | 841 |
842 // We are in the help page. | 842 // We are in the help page. |
843 EXPECT_EQ( | 843 EXPECT_EQ( |
844 "/transparencyreport/safebrowsing/", | 844 "/transparencyreport/safebrowsing/", |
845 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); | 845 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
846 } | 846 } |
OLD | NEW |