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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 706 |
707 // Verifies that the reporting checkbox is hidden on non-HTTP pages. | 707 // Verifies that the reporting checkbox is hidden on non-HTTP pages. |
708 // TODO(mattm): Should also verify that no report is sent, but there isn't a | 708 // TODO(mattm): Should also verify that no report is sent, but there isn't a |
709 // good way to do that in the current design. | 709 // good way to do that in the current design. |
710 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { | 710 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { |
711 browser()->profile()->GetPrefs()->SetBoolean( | 711 browser()->profile()->GetPrefs()->SetBoolean( |
712 prefs::kSafeBrowsingReportingEnabled, true); | 712 prefs::kSafeBrowsingReportingEnabled, true); |
713 | 713 |
714 net::TestServer https_server( | 714 net::TestServer https_server( |
715 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 715 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
716 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 716 net::TestServer::GetTestDataPath()); |
717 ASSERT_TRUE(https_server.Start()); | 717 ASSERT_TRUE(https_server.Start()); |
718 GURL url = https_server.GetURL(kEmptyPage); | 718 GURL url = https_server.GetURL(kEmptyPage); |
719 SetURLThreatType(url, SB_THREAT_TYPE_URL_MALWARE); | 719 SetURLThreatType(url, SB_THREAT_TYPE_URL_MALWARE); |
720 ui_test_utils::NavigateToURL(browser(), url); | 720 ui_test_utils::NavigateToURL(browser(), url); |
721 ASSERT_TRUE(WaitForReady()); | 721 ASSERT_TRUE(WaitForReady()); |
722 | 722 |
723 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); | 723 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); |
724 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 724 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
725 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 725 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
726 EXPECT_TRUE(Click("see-more-link")); | 726 EXPECT_TRUE(Click("see-more-link")); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 781 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
782 | 782 |
783 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); | 783 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); |
784 AssertNoInterstitial(false); // Assert the interstitial is gone | 784 AssertNoInterstitial(false); // Assert the interstitial is gone |
785 | 785 |
786 // We are in the help page. | 786 // We are in the help page. |
787 EXPECT_EQ( | 787 EXPECT_EQ( |
788 "/goodtoknow/online-safety/phishing/", | 788 "/goodtoknow/online-safety/phishing/", |
789 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); | 789 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
790 } | 790 } |
OLD | NEW |