| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| index 1a96ed167d982e1322bd79a437dc4cf06ef8369c..f744b11d8f0b11c5578909fcc5a078bc61707720 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
|
| @@ -305,18 +305,18 @@ class TestMalwareDetailsFactory : public MalwareDetailsFactory {
|
| };
|
|
|
| // A SafeBrowingBlockingPage class that lets us wait until it's hidden.
|
| -class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPageV2 {
|
| +class TestSafeBrowsingBlockingPageV2 : public SafeBrowsingBlockingPageV2 {
|
| public:
|
| - TestSafeBrowsingBlockingPage(SafeBrowsingUIManager* manager,
|
| - WebContents* web_contents,
|
| - const UnsafeResourceList& unsafe_resources)
|
| + TestSafeBrowsingBlockingPageV2(SafeBrowsingUIManager* manager,
|
| + WebContents* web_contents,
|
| + const UnsafeResourceList& unsafe_resources)
|
| : SafeBrowsingBlockingPageV2(manager, web_contents, unsafe_resources),
|
| wait_for_delete_(false) {
|
| // Don't wait the whole 3 seconds for the browser test.
|
| malware_details_proceed_delay_ms_ = 100;
|
| }
|
|
|
| - virtual ~TestSafeBrowsingBlockingPage() {
|
| + virtual ~TestSafeBrowsingBlockingPageV2() {
|
| LOG(INFO) << __FUNCTION__;
|
| if (!wait_for_delete_)
|
| return;
|
| @@ -350,10 +350,56 @@ class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPageV2 {
|
| bool wait_for_delete_;
|
| };
|
|
|
| +// A SafeBrowingBlockingPage class that lets us wait until it's hidden.
|
| +class TestSafeBrowsingBlockingPageV3 : public SafeBrowsingBlockingPageV3 {
|
| + public:
|
| + TestSafeBrowsingBlockingPageV3(SafeBrowsingUIManager* manager,
|
| + WebContents* web_contents,
|
| + const UnsafeResourceList& unsafe_resources)
|
| + : SafeBrowsingBlockingPageV3(manager, web_contents, unsafe_resources),
|
| + wait_for_delete_(false) {
|
| + // Don't wait the whole 3 seconds for the browser test.
|
| + malware_details_proceed_delay_ms_ = 100;
|
| + }
|
| +
|
| + virtual ~TestSafeBrowsingBlockingPageV3() {
|
| + LOG(INFO) << __FUNCTION__;
|
| + if (!wait_for_delete_)
|
| + return;
|
| +
|
| + // Notify that we are gone
|
| + base::MessageLoopForUI::current()->Quit();
|
| + wait_for_delete_ = false;
|
| + }
|
| +
|
| + void WaitForDelete() {
|
| + LOG(INFO) << __FUNCTION__;
|
| + wait_for_delete_ = true;
|
| + content::RunMessageLoop();
|
| + }
|
| +
|
| + // InterstitialPageDelegate methods:
|
| + virtual void CommandReceived(const std::string& command) OVERRIDE {
|
| + LOG(INFO) << __FUNCTION__ << " " << command;
|
| + SafeBrowsingBlockingPageV3::CommandReceived(command);
|
| + }
|
| + virtual void OnProceed() OVERRIDE {
|
| + LOG(INFO) << __FUNCTION__;
|
| + SafeBrowsingBlockingPageV3::OnProceed();
|
| + }
|
| + virtual void OnDontProceed() OVERRIDE {
|
| + LOG(INFO) << __FUNCTION__;
|
| + SafeBrowsingBlockingPageV3::OnDontProceed();
|
| + }
|
| +
|
| + private:
|
| + bool wait_for_delete_;
|
| +};
|
| +
|
| class TestSafeBrowsingBlockingPageFactory
|
| : public SafeBrowsingBlockingPageFactory {
|
| public:
|
| - TestSafeBrowsingBlockingPageFactory() { }
|
| + TestSafeBrowsingBlockingPageFactory() : version_(2) { }
|
| virtual ~TestSafeBrowsingBlockingPageFactory() { }
|
|
|
| virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
|
| @@ -361,28 +407,42 @@ class TestSafeBrowsingBlockingPageFactory
|
| WebContents* web_contents,
|
| const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources)
|
| OVERRIDE {
|
| - return new TestSafeBrowsingBlockingPage(delegate, web_contents,
|
| - unsafe_resources);
|
| + if (version_ == 3) {
|
| + return new TestSafeBrowsingBlockingPageV3(delegate, web_contents,
|
| + unsafe_resources);
|
| + }
|
| + return new TestSafeBrowsingBlockingPageV2(delegate, web_contents,
|
| + unsafe_resources);
|
| + }
|
| +
|
| + void SetTestVersion(int version) {
|
| + version_ = version;
|
| }
|
| +
|
| + private:
|
| + int version_;
|
| };
|
|
|
| } // namespace
|
|
|
| // Tests the safe browsing blocking page in a browser.
|
| -class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
|
| +class SafeBrowsingBlockingPageBrowserTest
|
| + : public InProcessBrowserTest,
|
| + public testing::WithParamInterface<int> {
|
| public:
|
| enum Visibility {
|
| VISIBILITY_ERROR = -1,
|
| HIDDEN = 0,
|
| - VISIBLE = 1,
|
| + VISIBLE = 1
|
| };
|
|
|
| - SafeBrowsingBlockingPageTest() {
|
| + SafeBrowsingBlockingPageBrowserTest() {
|
| }
|
|
|
| virtual void SetUp() OVERRIDE {
|
| SafeBrowsingService::RegisterFactory(&factory_);
|
| SafeBrowsingBlockingPage::RegisterFactory(&blocking_page_factory_);
|
| + blocking_page_factory_.SetTestVersion(GetParam());
|
| MalwareDetails::RegisterFactory(&details_factory_);
|
| InProcessBrowserTest::SetUp();
|
| }
|
| @@ -472,10 +532,17 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
|
|
|
| if (contents->ShowingInterstitialPage() && wait_for_delete) {
|
| // We'll get notified when the interstitial is deleted.
|
| - TestSafeBrowsingBlockingPage* page =
|
| - static_cast<TestSafeBrowsingBlockingPage*>(
|
| - contents->GetInterstitialPage()->GetDelegateForTesting());
|
| - page->WaitForDelete();
|
| + if (GetParam() == 3) {
|
| + TestSafeBrowsingBlockingPageV3* page =
|
| + static_cast<TestSafeBrowsingBlockingPageV3*>(
|
| + contents->GetInterstitialPage()->GetDelegateForTesting());
|
| + page->WaitForDelete();
|
| + } else {
|
| + TestSafeBrowsingBlockingPageV2* page =
|
| + static_cast<TestSafeBrowsingBlockingPageV2*>(
|
| + contents->GetInterstitialPage()->GetDelegateForTesting());
|
| + page->WaitForDelete();
|
| + }
|
| }
|
|
|
| // Can't use InterstitialPage::GetInterstitialPage() because that
|
| @@ -630,9 +697,13 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
|
| TestSafeBrowsingServiceFactory factory_;
|
| TestSafeBrowsingBlockingPageFactory blocking_page_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageTest);
|
| + DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageBrowserTest);
|
| };
|
|
|
| +INSTANTIATE_TEST_CASE_P(SafeBrowsingInterstitialVersions,
|
| + SafeBrowsingBlockingPageBrowserTest,
|
| + testing::Values(2, 3));
|
| +
|
| // TODO(linux_aura) http://crbug.com/163931
|
| // TODO(win_aura) http://crbug.com/154081
|
| #if defined(USE_AURA) && !defined(OS_CHROMEOS)
|
| @@ -640,7 +711,7 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
|
| #else
|
| #define MAYBE_MalwareRedirectInIFrameCanceled MalwareRedirectInIFrameCanceled
|
| #endif
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| MAYBE_MalwareRedirectInIFrameCanceled) {
|
| // 1. Test the case that redirect is a subresource.
|
| MalwareRedirectCancelAndProceed("openWinIFrame");
|
| @@ -649,7 +720,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| AssertNoInterstitial(true);
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| MalwareRedirectCanceled) {
|
| // 2. Test the case that redirect is the only resource.
|
| MalwareRedirectCancelAndProceed("openWin");
|
| @@ -658,7 +729,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| EXPECT_TRUE(YesInterstitial());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + MalwareDontProceed) {
|
| #if defined(OS_WIN) && defined(USE_ASH)
|
| // Disable this test in Metro+Ash for now (http://crbug.com/262796).
|
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
|
| @@ -667,35 +739,51 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) {
|
|
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
|
|
|
| - EXPECT_EQ(VISIBLE, GetVisibility("malware-icon"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| - EXPECT_TRUE(Click("see-more-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + if (GetParam() == 2) {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("malware-icon"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| + EXPECT_TRUE(Click("see-more-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| + } else {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("details"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(Click("details-button"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("details"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
|
| + }
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| AssertNoInterstitial(false); // Assert the interstitial is gone
|
| EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank"
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) {
|
| GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + if (GetParam() == 2)
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + else
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| AssertNoInterstitial(true); // Assert the interstitial is gone.
|
| EXPECT_EQ(url,
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| - MalwareLearnMore) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + MalwareLearnMoreV2) {
|
| + if (GetParam() == 3) return; // Don't have this link in V3.
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
|
|
|
| EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link"));
|
| @@ -707,7 +795,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| MalwareIframeDontProceed) {
|
| #if defined(OS_WIN) && defined(USE_ASH)
|
| // Disable this test in Metro+Ash for now (http://crbug.com/262796).
|
| @@ -717,29 +805,45 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
|
|
| SetupMalwareIframeWarningAndNavigate();
|
|
|
| - EXPECT_EQ(HIDDEN, GetVisibility("malware-icon"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("subresource-icon"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| - EXPECT_TRUE(Click("see-more-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + if (GetParam() == 2) {
|
| + EXPECT_EQ(HIDDEN, GetVisibility("malware-icon"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("subresource-icon"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| + EXPECT_TRUE(Click("see-more-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| + } else {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("details"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(Click("details-button"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("details"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
|
| + }
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| AssertNoInterstitial(false); // Assert the interstitial is gone
|
|
|
| EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank"
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + MalwareIframeProceed) {
|
| GURL url = SetupMalwareIframeWarningAndNavigate();
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + if (GetParam() == 2)
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + else
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| AssertNoInterstitial(true); // Assert the interstitial is gone
|
|
|
| EXPECT_EQ(url,
|
| @@ -753,8 +857,11 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) {
|
| #else
|
| #define MAYBE_MalwareIframeReportDetails MalwareIframeReportDetails
|
| #endif
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| MAYBE_MalwareIframeReportDetails) {
|
| + // TODO(felt): Enable for V3 when the checkbox is added.
|
| + if (GetParam() == 3) return;
|
| +
|
| scoped_refptr<content::MessageLoopRunner> malware_report_sent_runner(
|
| new content::MessageLoopRunner);
|
| SetReportSentCallback(malware_report_sent_runner->QuitClosure());
|
| @@ -795,12 +902,13 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
|
| // Verifies that the "proceed anyway" link isn't available when it is disabled
|
| // by the corresponding policy. Also verifies that sending the "proceed"
|
| // command anyway doesn't advance to the malware site.
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ProceedDisabled) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, ProceedDisabled) {
|
| #if defined(OS_WIN) && defined(USE_ASH)
|
| // Disable this test in Metro+Ash for now (http://crbug.com/262796).
|
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
|
| return;
|
| #endif
|
| + if (GetParam() == 3) return;
|
|
|
| // Simulate a policy disabling the "proceed anyway" link.
|
| browser()->profile()->GetPrefs()->SetBoolean(
|
| @@ -808,17 +916,28 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ProceedDisabled) {
|
|
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE);
|
|
|
| - EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
|
| - EXPECT_TRUE(Click("see-more-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
|
| + if (GetParam() == 2) {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("check-report"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
|
| + EXPECT_TRUE(Click("see-more-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-span"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + } else {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("details"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("final-paragraph"));
|
| + EXPECT_TRUE(Click("details-button"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("final-paragraph"));
|
| + SendCommand("proceed");
|
| + }
|
|
|
| // The "proceed" command should go back instead, if proceeding is disabled.
|
| - EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| AssertNoInterstitial(true);
|
| EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank"
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| @@ -827,12 +946,14 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ProceedDisabled) {
|
| // Verifies that the reporting checkbox is hidden on non-HTTP pages.
|
| // TODO(mattm): Should also verify that no report is sent, but there isn't a
|
| // good way to do that in the current design.
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, ReportingDisabled) {
|
| #if defined(OS_WIN) && defined(USE_ASH)
|
| // Disable this test in Metro+Ash for now (http://crbug.com/262796).
|
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
|
| return;
|
| #endif
|
| + // TODO(felt): Enable for V3 when the checkbox is added.
|
| + if (GetParam() == 3) return;
|
|
|
| browser()->profile()->GetPrefs()->SetBoolean(
|
| prefs::kSafeBrowsingExtendedReportingEnabled, true);
|
| @@ -859,7 +980,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) {
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + PhishingDontProceed) {
|
| #if defined(OS_WIN) && defined(USE_ASH)
|
| // Disable this test in Metro+Ash for now (http://crbug.com/262796).
|
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
|
| @@ -868,19 +990,31 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
|
|
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
|
|
|
| - EXPECT_EQ(HIDDEN, GetVisibility("malware-icon"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("check-report"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| - EXPECT_TRUE(Click("see-more-link"));
|
| - EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("report-error-link"));
|
| - EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + if (GetParam() == 2) {
|
| + EXPECT_EQ(HIDDEN, GetVisibility("malware-icon"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("check-report"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed"));
|
| + EXPECT_TRUE(Click("see-more-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("report-error-link"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| + } else {
|
| + EXPECT_EQ(VISIBLE, GetVisibility("primary-button"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("details"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(Click("details-button"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("details"));
|
| + EXPECT_EQ(VISIBLE, GetVisibility("proceed-link"));
|
| + EXPECT_EQ(HIDDEN, GetVisibility("error-code"));
|
| + EXPECT_TRUE(ClickAndWaitForDetach("primary-button"));
|
| + }
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("back"));
|
| AssertNoInterstitial(false); // Assert the interstitial is gone
|
| EXPECT_EQ(GURL(url::kAboutBlankURL), // We are back to "about:blank".
|
| browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
|
| @@ -893,12 +1027,15 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
|
| #else
|
| #define MAYBE_PhishingProceed PhishingProceed
|
| #endif
|
| -
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MAYBE_PhishingProceed) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + MAYBE_PhishingProceed) {
|
| GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
|
| LOG(INFO) << "1";
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + if (GetParam() == 2)
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
|
| + else
|
| + EXPECT_TRUE(ClickAndWaitForDetach("proceed-link"));
|
| LOG(INFO) << "2";
|
| AssertNoInterstitial(true); // Assert the interstitial is gone
|
| LOG(INFO) << "3";
|
| @@ -907,7 +1044,9 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MAYBE_PhishingProceed) {
|
| LOG(INFO) << "4";
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + PhishingReportErrorV2) {
|
| + if (GetParam() == 3) return; // Not supported in V3.
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
|
|
|
| EXPECT_TRUE(ClickAndWaitForDetach("report-error-link"));
|
| @@ -927,11 +1066,15 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
|
| #define MAYBE_PhishingLearnMore PhishingLearnMore
|
| #endif
|
|
|
| -IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MAYBE_PhishingLearnMore) {
|
| +IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
|
| + MAYBE_PhishingLearnMore) {
|
| SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING);
|
| LOG(INFO) << "1";
|
|
|
| - EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link"));
|
| + if (GetParam() == 2)
|
| + EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link"));
|
| + else
|
| + EXPECT_TRUE(ClickAndWaitForDetach("help-link"));
|
| LOG(INFO) << "2";
|
| AssertNoInterstitial(false); // Assert the interstitial is gone
|
|
|
|
|