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

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

Issue 584433002: Add UI for the new harmful download warning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add histograms to histograms.xml Created 6 years, 3 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 // 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 EXPECT_EQ(VISIBLE, GetVisibility("details")); 663 EXPECT_EQ(VISIBLE, GetVisibility("details"));
664 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); 664 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
665 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); 665 EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
666 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); 666 EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
667 667
668 AssertNoInterstitial(false); // Assert the interstitial is gone 668 AssertNoInterstitial(false); // Assert the interstitial is gone
669 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" 669 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank"
670 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 670 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
671 } 671 }
672 672
673 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest,
674 HarmfulDontProceed) {
675 #if defined(OS_WIN) && defined(USE_ASH)
676 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
677 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
678 return;
679 #endif
680
681 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_HARMFUL);
682
683 EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
684 EXPECT_EQ(HIDDEN, GetVisibility("details"));
685 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
686 EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
687 EXPECT_TRUE(Click("details-button"));
688 EXPECT_EQ(VISIBLE, GetVisibility("details"));
689 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
690 EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
691 EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
692
693 AssertNoInterstitial(false); // Assert the interstitial is gone
694 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank"
695 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
696 }
697
673 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) { 698 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) {
674 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); 699 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
675 700
676 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); 701 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
677 AssertNoInterstitial(true); // Assert the interstitial is gone. 702 AssertNoInterstitial(true); // Assert the interstitial is gone.
678 EXPECT_EQ(url, 703 EXPECT_EQ(url,
679 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); 704 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
680 } 705 }
681 706
707 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, HarmfulProceed) {
708 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
mattm 2014/09/19 21:28:16 HARMFUL
felt 2014/09/22 16:42:16 Done.
709
710 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
711 AssertNoInterstitial(true); // Assert the interstitial is gone.
712 EXPECT_EQ(url,
713 browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
714 }
715
682 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, 716 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest,
683 MalwareIframeDontProceed) { 717 MalwareIframeDontProceed) {
684 #if defined(OS_WIN) && defined(USE_ASH) 718 #if defined(OS_WIN) && defined(USE_ASH)
685 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 719 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
686 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 720 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
687 return; 721 return;
688 #endif 722 #endif
689 723
690 SetupMalwareIframeWarningAndNavigate(); 724 SetupMalwareIframeWarningAndNavigate();
691 725
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, PhishingLearnMore) { 881 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageBrowserTest, PhishingLearnMore) {
848 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); 882 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
849 EXPECT_TRUE(ClickAndWaitForDetach("help-link")); 883 EXPECT_TRUE(ClickAndWaitForDetach("help-link"));
850 AssertNoInterstitial(false); // Assert the interstitial is gone 884 AssertNoInterstitial(false); // Assert the interstitial is gone
851 885
852 // We are in the help page. 886 // We are in the help page.
853 EXPECT_EQ( 887 EXPECT_EQ(
854 "/transparencyreport/safebrowsing/", 888 "/transparencyreport/safebrowsing/",
855 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); 889 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
856 } 890 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698