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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 FakeMalwareDetails* get_details() { | 299 FakeMalwareDetails* get_details() { |
300 return details_; | 300 return details_; |
301 } | 301 } |
302 | 302 |
303 private: | 303 private: |
304 FakeMalwareDetails* details_; | 304 FakeMalwareDetails* details_; |
305 }; | 305 }; |
306 | 306 |
307 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. | 307 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. |
308 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPageV2 { | 308 class TestSafeBrowsingBlockingPageV2 : public SafeBrowsingBlockingPageV2 { |
309 public: | 309 public: |
310 TestSafeBrowsingBlockingPage(SafeBrowsingUIManager* manager, | 310 TestSafeBrowsingBlockingPageV2(SafeBrowsingUIManager* manager, |
311 WebContents* web_contents, | 311 WebContents* web_contents, |
312 const UnsafeResourceList& unsafe_resources) | 312 const UnsafeResourceList& unsafe_resources) |
313 : SafeBrowsingBlockingPageV2(manager, web_contents, unsafe_resources), | 313 : SafeBrowsingBlockingPageV2(manager, web_contents, unsafe_resources), |
314 wait_for_delete_(false) { | 314 wait_for_delete_(false) { |
315 // Don't wait the whole 3 seconds for the browser test. | 315 // Don't wait the whole 3 seconds for the browser test. |
316 malware_details_proceed_delay_ms_ = 100; | 316 malware_details_proceed_delay_ms_ = 100; |
317 } | 317 } |
318 | 318 |
319 virtual ~TestSafeBrowsingBlockingPage() { | 319 virtual ~TestSafeBrowsingBlockingPageV2() { |
320 LOG(INFO) << __FUNCTION__; | 320 LOG(INFO) << __FUNCTION__; |
321 if (!wait_for_delete_) | 321 if (!wait_for_delete_) |
322 return; | 322 return; |
323 | 323 |
324 // Notify that we are gone | 324 // Notify that we are gone |
325 base::MessageLoopForUI::current()->Quit(); | 325 base::MessageLoopForUI::current()->Quit(); |
326 wait_for_delete_ = false; | 326 wait_for_delete_ = false; |
327 } | 327 } |
328 | 328 |
329 void WaitForDelete() { | 329 void WaitForDelete() { |
(...skipping 13 matching lines...) Expand all Loading... |
343 } | 343 } |
344 virtual void OnDontProceed() OVERRIDE { | 344 virtual void OnDontProceed() OVERRIDE { |
345 LOG(INFO) << __FUNCTION__; | 345 LOG(INFO) << __FUNCTION__; |
346 SafeBrowsingBlockingPageV2::OnDontProceed(); | 346 SafeBrowsingBlockingPageV2::OnDontProceed(); |
347 } | 347 } |
348 | 348 |
349 private: | 349 private: |
350 bool wait_for_delete_; | 350 bool wait_for_delete_; |
351 }; | 351 }; |
352 | 352 |
| 353 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. |
| 354 class TestSafeBrowsingBlockingPageV3 : public SafeBrowsingBlockingPageV3 { |
| 355 public: |
| 356 TestSafeBrowsingBlockingPageV3(SafeBrowsingUIManager* manager, |
| 357 WebContents* web_contents, |
| 358 const UnsafeResourceList& unsafe_resources) |
| 359 : SafeBrowsingBlockingPageV3(manager, web_contents, unsafe_resources), |
| 360 wait_for_delete_(false) { |
| 361 // Don't wait the whole 3 seconds for the browser test. |
| 362 malware_details_proceed_delay_ms_ = 100; |
| 363 } |
| 364 |
| 365 virtual ~TestSafeBrowsingBlockingPageV3() { |
| 366 LOG(INFO) << __FUNCTION__; |
| 367 if (!wait_for_delete_) |
| 368 return; |
| 369 |
| 370 // Notify that we are gone |
| 371 base::MessageLoopForUI::current()->Quit(); |
| 372 wait_for_delete_ = false; |
| 373 } |
| 374 |
| 375 void WaitForDelete() { |
| 376 LOG(INFO) << __FUNCTION__; |
| 377 wait_for_delete_ = true; |
| 378 content::RunMessageLoop(); |
| 379 } |
| 380 |
| 381 // InterstitialPageDelegate methods: |
| 382 virtual void CommandReceived(const std::string& command) OVERRIDE { |
| 383 LOG(INFO) << __FUNCTION__ << " " << command; |
| 384 SafeBrowsingBlockingPageV3::CommandReceived(command); |
| 385 } |
| 386 virtual void OnProceed() OVERRIDE { |
| 387 LOG(INFO) << __FUNCTION__; |
| 388 SafeBrowsingBlockingPageV3::OnProceed(); |
| 389 } |
| 390 virtual void OnDontProceed() OVERRIDE { |
| 391 LOG(INFO) << __FUNCTION__; |
| 392 SafeBrowsingBlockingPageV3::OnDontProceed(); |
| 393 } |
| 394 |
| 395 private: |
| 396 bool wait_for_delete_; |
| 397 }; |
| 398 |
353 class TestSafeBrowsingBlockingPageFactory | 399 class TestSafeBrowsingBlockingPageFactory |
354 : public SafeBrowsingBlockingPageFactory { | 400 : public SafeBrowsingBlockingPageFactory { |
355 public: | 401 public: |
356 TestSafeBrowsingBlockingPageFactory() { } | 402 TestSafeBrowsingBlockingPageFactory() : version_(2) { } |
357 virtual ~TestSafeBrowsingBlockingPageFactory() { } | 403 virtual ~TestSafeBrowsingBlockingPageFactory() { } |
358 | 404 |
359 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 405 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
360 SafeBrowsingUIManager* delegate, | 406 SafeBrowsingUIManager* delegate, |
361 WebContents* web_contents, | 407 WebContents* web_contents, |
362 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) | 408 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) |
363 OVERRIDE { | 409 OVERRIDE { |
364 return new TestSafeBrowsingBlockingPage(delegate, web_contents, | 410 if (version_ == 3) { |
365 unsafe_resources); | 411 return new TestSafeBrowsingBlockingPageV3(delegate, web_contents, |
| 412 unsafe_resources); |
| 413 } |
| 414 return new TestSafeBrowsingBlockingPageV2(delegate, web_contents, |
| 415 unsafe_resources); |
366 } | 416 } |
| 417 |
| 418 void SetTestVersion(int version) { |
| 419 version_ = version; |
| 420 } |
| 421 |
| 422 private: |
| 423 int version_; |
367 }; | 424 }; |
368 | 425 |
369 } // namespace | 426 } // namespace |
370 | 427 |
371 // Tests the safe browsing blocking page in a browser. | 428 // Tests the safe browsing blocking page in a browser. |
372 class SafeBrowsingBlockingPageTest : public InProcessBrowserTest { | 429 class SafeBrowsingBlockingPageBrowserTest |
| 430 : public InProcessBrowserTest, |
| 431 public testing::WithParamInterface<int> { |
373 public: | 432 public: |
374 enum Visibility { | 433 enum Visibility { |
375 VISIBILITY_ERROR = -1, | 434 VISIBILITY_ERROR = -1, |
376 HIDDEN = 0, | 435 HIDDEN = 0, |
377 VISIBLE = 1, | 436 VISIBLE = 1 |
378 }; | 437 }; |
379 | 438 |
380 SafeBrowsingBlockingPageTest() { | 439 SafeBrowsingBlockingPageBrowserTest() { |
381 } | 440 } |
382 | 441 |
383 virtual void SetUp() OVERRIDE { | 442 virtual void SetUp() OVERRIDE { |
384 SafeBrowsingService::RegisterFactory(&factory_); | 443 SafeBrowsingService::RegisterFactory(&factory_); |
385 SafeBrowsingBlockingPage::RegisterFactory(&blocking_page_factory_); | 444 SafeBrowsingBlockingPage::RegisterFactory(&blocking_page_factory_); |
| 445 blocking_page_factory_.SetTestVersion(GetParam()); |
386 MalwareDetails::RegisterFactory(&details_factory_); | 446 MalwareDetails::RegisterFactory(&details_factory_); |
387 InProcessBrowserTest::SetUp(); | 447 InProcessBrowserTest::SetUp(); |
388 } | 448 } |
389 | 449 |
390 virtual void TearDown() OVERRIDE { | 450 virtual void TearDown() OVERRIDE { |
391 InProcessBrowserTest::TearDown(); | 451 InProcessBrowserTest::TearDown(); |
392 SafeBrowsingBlockingPage::RegisterFactory(NULL); | 452 SafeBrowsingBlockingPage::RegisterFactory(NULL); |
393 SafeBrowsingService::RegisterFactory(NULL); | 453 SafeBrowsingService::RegisterFactory(NULL); |
394 MalwareDetails::RegisterFactory(NULL); | 454 MalwareDetails::RegisterFactory(NULL); |
395 } | 455 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ASSERT_TRUE(interstitial_page); | 525 ASSERT_TRUE(interstitial_page); |
466 interstitial_page->Proceed(); | 526 interstitial_page->Proceed(); |
467 } | 527 } |
468 | 528 |
469 void AssertNoInterstitial(bool wait_for_delete) { | 529 void AssertNoInterstitial(bool wait_for_delete) { |
470 WebContents* contents = | 530 WebContents* contents = |
471 browser()->tab_strip_model()->GetActiveWebContents(); | 531 browser()->tab_strip_model()->GetActiveWebContents(); |
472 | 532 |
473 if (contents->ShowingInterstitialPage() && wait_for_delete) { | 533 if (contents->ShowingInterstitialPage() && wait_for_delete) { |
474 // We'll get notified when the interstitial is deleted. | 534 // We'll get notified when the interstitial is deleted. |
475 TestSafeBrowsingBlockingPage* page = | 535 if (GetParam() == 3) { |
476 static_cast<TestSafeBrowsingBlockingPage*>( | 536 TestSafeBrowsingBlockingPageV3* page = |
477 contents->GetInterstitialPage()->GetDelegateForTesting()); | 537 static_cast<TestSafeBrowsingBlockingPageV3*>( |
478 page->WaitForDelete(); | 538 contents->GetInterstitialPage()->GetDelegateForTesting()); |
| 539 page->WaitForDelete(); |
| 540 } else { |
| 541 TestSafeBrowsingBlockingPageV2* page = |
| 542 static_cast<TestSafeBrowsingBlockingPageV2*>( |
| 543 contents->GetInterstitialPage()->GetDelegateForTesting()); |
| 544 page->WaitForDelete(); |
| 545 } |
479 } | 546 } |
480 | 547 |
481 // Can't use InterstitialPage::GetInterstitialPage() because that | 548 // Can't use InterstitialPage::GetInterstitialPage() because that |
482 // gets updated after the TestSafeBrowsingBlockingPage destructor | 549 // gets updated after the TestSafeBrowsingBlockingPage destructor |
483 ASSERT_FALSE(contents->ShowingInterstitialPage()); | 550 ASSERT_FALSE(contents->ShowingInterstitialPage()); |
484 } | 551 } |
485 | 552 |
486 bool YesInterstitial() { | 553 bool YesInterstitial() { |
487 WebContents* contents = | 554 WebContents* contents = |
488 browser()->tab_strip_model()->GetActiveWebContents(); | 555 browser()->tab_strip_model()->GetActiveWebContents(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 return true; | 690 return true; |
624 } | 691 } |
625 | 692 |
626 protected: | 693 protected: |
627 TestMalwareDetailsFactory details_factory_; | 694 TestMalwareDetailsFactory details_factory_; |
628 | 695 |
629 private: | 696 private: |
630 TestSafeBrowsingServiceFactory factory_; | 697 TestSafeBrowsingServiceFactory factory_; |
631 TestSafeBrowsingBlockingPageFactory blocking_page_factory_; | 698 TestSafeBrowsingBlockingPageFactory blocking_page_factory_; |
632 | 699 |
633 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageTest); | 700 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageBrowserTest); |
634 }; | 701 }; |
635 | 702 |
| 703 INSTANTIATE_TEST_CASE_P(SafeBrowsingInterstitialVersions, |
| 704 SafeBrowsingBlockingPageBrowserTest, |
| 705 testing::Values(2, 3)); |
| 706 |
636 // TODO(linux_aura) http://crbug.com/163931 | 707 // TODO(linux_aura) http://crbug.com/163931 |
637 // TODO(win_aura) http://crbug.com/154081 | 708 // TODO(win_aura) http://crbug.com/154081 |
638 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 709 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
639 #define MAYBE_MalwareRedirectInIFrameCanceled DISABLED_MalwareRedirectInIFrameCa
nceled | 710 #define MAYBE_MalwareRedirectInIFrameCanceled DISABLED_MalwareRedirectInIFrameCa
nceled |
640 #else | 711 #else |
641 #define MAYBE_MalwareRedirectInIFrameCanceled MalwareRedirectInIFrameCanceled | 712 #define MAYBE_MalwareRedirectInIFrameCanceled MalwareRedirectInIFrameCanceled |
642 #endif | 713 #endif |
643 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 714 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
644 MAYBE_MalwareRedirectInIFrameCanceled) { | 715 MAYBE_MalwareRedirectInIFrameCanceled) { |
645 // 1. Test the case that redirect is a subresource. | 716 // 1. Test the case that redirect is a subresource. |
646 MalwareRedirectCancelAndProceed("openWinIFrame"); | 717 MalwareRedirectCancelAndProceed("openWinIFrame"); |
647 // If the redirect was from subresource but canceled, "proceed" will continue | 718 // If the redirect was from subresource but canceled, "proceed" will continue |
648 // with the rest of resources. | 719 // with the rest of resources. |
649 AssertNoInterstitial(true); | 720 AssertNoInterstitial(true); |
650 } | 721 } |
651 | 722 |
652 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 723 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
653 MalwareRedirectCanceled) { | 724 MalwareRedirectCanceled) { |
654 // 2. Test the case that redirect is the only resource. | 725 // 2. Test the case that redirect is the only resource. |
655 MalwareRedirectCancelAndProceed("openWin"); | 726 MalwareRedirectCancelAndProceed("openWin"); |
656 // Clicking proceed won't do anything if the main request is cancelled | 727 // Clicking proceed won't do anything if the main request is cancelled |
657 // already. See crbug.com/76460. | 728 // already. See crbug.com/76460. |
658 EXPECT_TRUE(YesInterstitial()); | 729 EXPECT_TRUE(YesInterstitial()); |
659 } | 730 } |
660 | 731 |
661 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) { | 732 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
| 733 MalwareDontProceed) { |
662 #if defined(OS_WIN) && defined(USE_ASH) | 734 #if defined(OS_WIN) && defined(USE_ASH) |
663 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 735 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
664 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 736 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
665 return; | 737 return; |
666 #endif | 738 #endif |
667 | 739 |
668 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); | 740 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); |
669 | 741 |
670 EXPECT_EQ(VISIBLE, GetVisibility("malware-icon")); | 742 if (GetParam() == 2) { |
671 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon")); | 743 EXPECT_EQ(VISIBLE, GetVisibility("malware-icon")); |
672 EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon")); | 744 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon")); |
673 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); | 745 EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon")); |
674 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 746 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); |
675 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); | 747 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
676 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 748 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); |
677 EXPECT_TRUE(Click("see-more-link")); | 749 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
678 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); | 750 EXPECT_TRUE(Click("see-more-link")); |
679 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); | 751 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); |
680 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); | 752 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); |
| 753 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); |
| 754 EXPECT_TRUE(ClickAndWaitForDetach("back")); |
| 755 } else { |
| 756 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); |
| 757 EXPECT_EQ(HIDDEN, GetVisibility("details")); |
| 758 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
| 759 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 760 EXPECT_TRUE(Click("details-button")); |
| 761 EXPECT_EQ(VISIBLE, GetVisibility("details")); |
| 762 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); |
| 763 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 764 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); |
| 765 } |
681 | 766 |
682 EXPECT_TRUE(ClickAndWaitForDetach("back")); | |
683 AssertNoInterstitial(false); // Assert the interstitial is gone | 767 AssertNoInterstitial(false); // Assert the interstitial is gone |
684 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" | 768 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" |
685 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 769 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
686 } | 770 } |
687 | 771 |
688 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) { | 772 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, MalwareProceed) { |
689 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); | 773 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); |
690 | 774 |
691 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); | 775 if (GetParam() == 2) |
| 776 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); |
| 777 else |
| 778 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); |
692 AssertNoInterstitial(true); // Assert the interstitial is gone. | 779 AssertNoInterstitial(true); // Assert the interstitial is gone. |
693 EXPECT_EQ(url, | 780 EXPECT_EQ(url, |
694 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 781 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
695 } | 782 } |
696 | 783 |
697 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 784 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
698 MalwareLearnMore) { | 785 MalwareLearnMoreV2) { |
| 786 if (GetParam() == 3) return; // Don't have this link in V3. |
699 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); | 787 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); |
700 | 788 |
701 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); | 789 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); |
702 AssertNoInterstitial(false); // Assert the interstitial is gone | 790 AssertNoInterstitial(false); // Assert the interstitial is gone |
703 | 791 |
704 // We are in the help page. | 792 // We are in the help page. |
705 EXPECT_EQ( | 793 EXPECT_EQ( |
706 "/transparencyreport/safebrowsing/", | 794 "/transparencyreport/safebrowsing/", |
707 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); | 795 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
708 } | 796 } |
709 | 797 |
710 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 798 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
711 MalwareIframeDontProceed) { | 799 MalwareIframeDontProceed) { |
712 #if defined(OS_WIN) && defined(USE_ASH) | 800 #if defined(OS_WIN) && defined(USE_ASH) |
713 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 801 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
714 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 802 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
715 return; | 803 return; |
716 #endif | 804 #endif |
717 | 805 |
718 SetupMalwareIframeWarningAndNavigate(); | 806 SetupMalwareIframeWarningAndNavigate(); |
719 | 807 |
720 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon")); | 808 if (GetParam() == 2) { |
721 EXPECT_EQ(VISIBLE, GetVisibility("subresource-icon")); | 809 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon")); |
722 EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon")); | 810 EXPECT_EQ(VISIBLE, GetVisibility("subresource-icon")); |
723 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); | 811 EXPECT_EQ(HIDDEN, GetVisibility("phishing-icon")); |
724 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 812 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); |
725 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); | 813 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
726 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 814 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); |
727 EXPECT_TRUE(Click("see-more-link")); | 815 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
728 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); | 816 EXPECT_TRUE(Click("see-more-link")); |
729 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); | 817 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); |
730 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); | 818 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); |
| 819 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); |
| 820 EXPECT_TRUE(ClickAndWaitForDetach("back")); |
| 821 } else { |
| 822 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); |
| 823 EXPECT_EQ(HIDDEN, GetVisibility("details")); |
| 824 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
| 825 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 826 EXPECT_TRUE(Click("details-button")); |
| 827 EXPECT_EQ(VISIBLE, GetVisibility("details")); |
| 828 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); |
| 829 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 830 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); |
| 831 } |
731 | 832 |
732 EXPECT_TRUE(ClickAndWaitForDetach("back")); | |
733 AssertNoInterstitial(false); // Assert the interstitial is gone | 833 AssertNoInterstitial(false); // Assert the interstitial is gone |
734 | 834 |
735 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" | 835 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" |
736 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 836 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
737 } | 837 } |
738 | 838 |
739 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) { | 839 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
| 840 MalwareIframeProceed) { |
740 GURL url = SetupMalwareIframeWarningAndNavigate(); | 841 GURL url = SetupMalwareIframeWarningAndNavigate(); |
741 | 842 |
742 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); | 843 if (GetParam() == 2) |
| 844 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); |
| 845 else |
| 846 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); |
743 AssertNoInterstitial(true); // Assert the interstitial is gone | 847 AssertNoInterstitial(true); // Assert the interstitial is gone |
744 | 848 |
745 EXPECT_EQ(url, | 849 EXPECT_EQ(url, |
746 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 850 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
747 } | 851 } |
748 | 852 |
749 // http://crbug.com/273302 | 853 // http://crbug.com/273302 |
750 #if defined(OS_WIN) | 854 #if defined(OS_WIN) |
751 // Temporarily re-enabled to get some logs. | 855 // Temporarily re-enabled to get some logs. |
752 #define MAYBE_MalwareIframeReportDetails MalwareIframeReportDetails | 856 #define MAYBE_MalwareIframeReportDetails MalwareIframeReportDetails |
753 #else | 857 #else |
754 #define MAYBE_MalwareIframeReportDetails MalwareIframeReportDetails | 858 #define MAYBE_MalwareIframeReportDetails MalwareIframeReportDetails |
755 #endif | 859 #endif |
756 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 860 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
757 MAYBE_MalwareIframeReportDetails) { | 861 MAYBE_MalwareIframeReportDetails) { |
| 862 // TODO(felt): Enable for V3 when the checkbox is added. |
| 863 if (GetParam() == 3) return; |
| 864 |
758 scoped_refptr<content::MessageLoopRunner> malware_report_sent_runner( | 865 scoped_refptr<content::MessageLoopRunner> malware_report_sent_runner( |
759 new content::MessageLoopRunner); | 866 new content::MessageLoopRunner); |
760 SetReportSentCallback(malware_report_sent_runner->QuitClosure()); | 867 SetReportSentCallback(malware_report_sent_runner->QuitClosure()); |
761 | 868 |
762 GURL url = SetupMalwareIframeWarningAndNavigate(); | 869 GURL url = SetupMalwareIframeWarningAndNavigate(); |
763 | 870 |
764 LOG(INFO) << "1"; | 871 LOG(INFO) << "1"; |
765 | 872 |
766 // If the DOM details from renderer did not already return, wait for them. | 873 // If the DOM details from renderer did not already return, wait for them. |
767 details_factory_.get_details()->WaitForDOM(); | 874 details_factory_.get_details()->WaitForDOM(); |
(...skipping 20 matching lines...) Expand all Loading... |
788 safe_browsing::ClientMalwareReportRequest report; | 895 safe_browsing::ClientMalwareReportRequest report; |
789 ASSERT_TRUE(report.ParseFromString(serialized)); | 896 ASSERT_TRUE(report.ParseFromString(serialized)); |
790 // Verify the report is complete. | 897 // Verify the report is complete. |
791 EXPECT_TRUE(report.complete()); | 898 EXPECT_TRUE(report.complete()); |
792 LOG(INFO) << "8"; | 899 LOG(INFO) << "8"; |
793 } | 900 } |
794 | 901 |
795 // Verifies that the "proceed anyway" link isn't available when it is disabled | 902 // Verifies that the "proceed anyway" link isn't available when it is disabled |
796 // by the corresponding policy. Also verifies that sending the "proceed" | 903 // by the corresponding policy. Also verifies that sending the "proceed" |
797 // command anyway doesn't advance to the malware site. | 904 // command anyway doesn't advance to the malware site. |
798 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ProceedDisabled) { | 905 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, ProceedDisabled) { |
799 #if defined(OS_WIN) && defined(USE_ASH) | 906 #if defined(OS_WIN) && defined(USE_ASH) |
800 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 907 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
801 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 908 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
802 return; | 909 return; |
803 #endif | 910 #endif |
| 911 if (GetParam() == 3) return; |
804 | 912 |
805 // Simulate a policy disabling the "proceed anyway" link. | 913 // Simulate a policy disabling the "proceed anyway" link. |
806 browser()->profile()->GetPrefs()->SetBoolean( | 914 browser()->profile()->GetPrefs()->SetBoolean( |
807 prefs::kSafeBrowsingProceedAnywayDisabled, true); | 915 prefs::kSafeBrowsingProceedAnywayDisabled, true); |
808 | 916 |
809 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); | 917 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_MALWARE); |
810 | 918 |
811 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); | 919 if (GetParam() == 2) { |
812 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 920 EXPECT_EQ(VISIBLE, GetVisibility("check-report")); |
813 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 921 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
814 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); | 922 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
815 EXPECT_TRUE(Click("see-more-link")); | 923 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); |
816 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); | 924 EXPECT_TRUE(Click("see-more-link")); |
817 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 925 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); |
818 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); | 926 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
| 927 EXPECT_EQ(HIDDEN, GetVisibility("proceed-span")); |
| 928 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); |
| 929 } else { |
| 930 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); |
| 931 EXPECT_EQ(HIDDEN, GetVisibility("details")); |
| 932 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
| 933 EXPECT_EQ(HIDDEN, GetVisibility("final-paragraph")); |
| 934 EXPECT_TRUE(Click("details-button")); |
| 935 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
| 936 EXPECT_EQ(HIDDEN, GetVisibility("final-paragraph")); |
| 937 SendCommand("proceed"); |
| 938 } |
819 | 939 |
820 // The "proceed" command should go back instead, if proceeding is disabled. | 940 // The "proceed" command should go back instead, if proceeding is disabled. |
821 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); | |
822 AssertNoInterstitial(true); | 941 AssertNoInterstitial(true); |
823 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" | 942 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" |
824 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 943 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
825 } | 944 } |
826 | 945 |
827 // Verifies that the reporting checkbox is hidden on non-HTTP pages. | 946 // Verifies that the reporting checkbox is hidden on non-HTTP pages. |
828 // TODO(mattm): Should also verify that no report is sent, but there isn't a | 947 // TODO(mattm): Should also verify that no report is sent, but there isn't a |
829 // good way to do that in the current design. | 948 // good way to do that in the current design. |
830 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) { | 949 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, ReportingDisabled) { |
831 #if defined(OS_WIN) && defined(USE_ASH) | 950 #if defined(OS_WIN) && defined(USE_ASH) |
832 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 951 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
833 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 952 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
834 return; | 953 return; |
835 #endif | 954 #endif |
| 955 // TODO(felt): Enable for V3 when the checkbox is added. |
| 956 if (GetParam() == 3) return; |
836 | 957 |
837 browser()->profile()->GetPrefs()->SetBoolean( | 958 browser()->profile()->GetPrefs()->SetBoolean( |
838 prefs::kSafeBrowsingExtendedReportingEnabled, true); | 959 prefs::kSafeBrowsingExtendedReportingEnabled, true); |
839 | 960 |
840 net::SpawnedTestServer https_server( | 961 net::SpawnedTestServer https_server( |
841 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, | 962 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, |
842 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 963 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
843 ASSERT_TRUE(https_server.Start()); | 964 ASSERT_TRUE(https_server.Start()); |
844 GURL url = https_server.GetURL(kEmptyPage); | 965 GURL url = https_server.GetURL(kEmptyPage); |
845 SetURLThreatType(url, SB_THREAT_TYPE_URL_MALWARE); | 966 SetURLThreatType(url, SB_THREAT_TYPE_URL_MALWARE); |
846 ui_test_utils::NavigateToURL(browser(), url); | 967 ui_test_utils::NavigateToURL(browser(), url); |
847 ASSERT_TRUE(WaitForReady()); | 968 ASSERT_TRUE(WaitForReady()); |
848 | 969 |
849 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); | 970 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); |
850 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 971 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
851 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 972 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
852 EXPECT_TRUE(Click("see-more-link")); | 973 EXPECT_TRUE(Click("see-more-link")); |
853 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); | 974 EXPECT_EQ(VISIBLE, GetVisibility("show-diagnostic-link")); |
854 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); | 975 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); |
855 | 976 |
856 EXPECT_TRUE(ClickAndWaitForDetach("back")); | 977 EXPECT_TRUE(ClickAndWaitForDetach("back")); |
857 AssertNoInterstitial(false); // Assert the interstitial is gone | 978 AssertNoInterstitial(false); // Assert the interstitial is gone |
858 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" | 979 EXPECT_EQ(GURL(url::kAboutBlankURL), // Back to "about:blank" |
859 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 980 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
860 } | 981 } |
861 | 982 |
862 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) { | 983 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
| 984 PhishingDontProceed) { |
863 #if defined(OS_WIN) && defined(USE_ASH) | 985 #if defined(OS_WIN) && defined(USE_ASH) |
864 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 986 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
865 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 987 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
866 return; | 988 return; |
867 #endif | 989 #endif |
868 | 990 |
869 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 991 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
870 | 992 |
871 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon")); | 993 if (GetParam() == 2) { |
872 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon")); | 994 EXPECT_EQ(HIDDEN, GetVisibility("malware-icon")); |
873 EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon")); | 995 EXPECT_EQ(HIDDEN, GetVisibility("subresource-icon")); |
874 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); | 996 EXPECT_EQ(VISIBLE, GetVisibility("phishing-icon")); |
875 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 997 EXPECT_EQ(HIDDEN, GetVisibility("check-report")); |
876 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); | 998 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
877 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); | 999 EXPECT_EQ(HIDDEN, GetVisibility("report-error-link")); |
878 EXPECT_TRUE(Click("see-more-link")); | 1000 EXPECT_EQ(HIDDEN, GetVisibility("proceed")); |
879 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); | 1001 EXPECT_TRUE(Click("see-more-link")); |
880 EXPECT_EQ(VISIBLE, GetVisibility("report-error-link")); | 1002 EXPECT_EQ(HIDDEN, GetVisibility("show-diagnostic-link")); |
881 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); | 1003 EXPECT_EQ(VISIBLE, GetVisibility("report-error-link")); |
| 1004 EXPECT_EQ(VISIBLE, GetVisibility("proceed")); |
| 1005 EXPECT_TRUE(ClickAndWaitForDetach("back")); |
| 1006 } else { |
| 1007 EXPECT_EQ(VISIBLE, GetVisibility("primary-button")); |
| 1008 EXPECT_EQ(HIDDEN, GetVisibility("details")); |
| 1009 EXPECT_EQ(HIDDEN, GetVisibility("proceed-link")); |
| 1010 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 1011 EXPECT_TRUE(Click("details-button")); |
| 1012 EXPECT_EQ(VISIBLE, GetVisibility("details")); |
| 1013 EXPECT_EQ(VISIBLE, GetVisibility("proceed-link")); |
| 1014 EXPECT_EQ(HIDDEN, GetVisibility("error-code")); |
| 1015 EXPECT_TRUE(ClickAndWaitForDetach("primary-button")); |
| 1016 } |
882 | 1017 |
883 EXPECT_TRUE(ClickAndWaitForDetach("back")); | |
884 AssertNoInterstitial(false); // Assert the interstitial is gone | 1018 AssertNoInterstitial(false); // Assert the interstitial is gone |
885 EXPECT_EQ(GURL(url::kAboutBlankURL), // We are back to "about:blank". | 1019 EXPECT_EQ(GURL(url::kAboutBlankURL), // We are back to "about:blank". |
886 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1020 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
887 } | 1021 } |
888 | 1022 |
889 // http://crbug.com/247763 | 1023 // http://crbug.com/247763 |
890 #if defined(OS_WIN) | 1024 #if defined(OS_WIN) |
891 // Temporarily re-enabled to get some logs. | 1025 // Temporarily re-enabled to get some logs. |
892 #define MAYBE_PhishingProceed PhishingProceed | 1026 #define MAYBE_PhishingProceed PhishingProceed |
893 #else | 1027 #else |
894 #define MAYBE_PhishingProceed PhishingProceed | 1028 #define MAYBE_PhishingProceed PhishingProceed |
895 #endif | 1029 #endif |
896 | 1030 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
897 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MAYBE_PhishingProceed) { | 1031 MAYBE_PhishingProceed) { |
898 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 1032 GURL url = SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
899 LOG(INFO) << "1"; | 1033 LOG(INFO) << "1"; |
900 | 1034 |
901 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); | 1035 if (GetParam() == 2) |
| 1036 EXPECT_TRUE(ClickAndWaitForDetach("proceed")); |
| 1037 else |
| 1038 EXPECT_TRUE(ClickAndWaitForDetach("proceed-link")); |
902 LOG(INFO) << "2"; | 1039 LOG(INFO) << "2"; |
903 AssertNoInterstitial(true); // Assert the interstitial is gone | 1040 AssertNoInterstitial(true); // Assert the interstitial is gone |
904 LOG(INFO) << "3"; | 1041 LOG(INFO) << "3"; |
905 EXPECT_EQ(url, | 1042 EXPECT_EQ(url, |
906 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); | 1043 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
907 LOG(INFO) << "4"; | 1044 LOG(INFO) << "4"; |
908 } | 1045 } |
909 | 1046 |
910 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) { | 1047 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
| 1048 PhishingReportErrorV2) { |
| 1049 if (GetParam() == 3) return; // Not supported in V3. |
911 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 1050 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
912 | 1051 |
913 EXPECT_TRUE(ClickAndWaitForDetach("report-error-link")); | 1052 EXPECT_TRUE(ClickAndWaitForDetach("report-error-link")); |
914 AssertNoInterstitial(false); // Assert the interstitial is gone | 1053 AssertNoInterstitial(false); // Assert the interstitial is gone |
915 | 1054 |
916 // We are in the error reporting page. | 1055 // We are in the error reporting page. |
917 EXPECT_EQ( | 1056 EXPECT_EQ( |
918 "/safebrowsing/report_error/", | 1057 "/safebrowsing/report_error/", |
919 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); | 1058 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
920 } | 1059 } |
921 | 1060 |
922 // See crbug.com/248447 | 1061 // See crbug.com/248447 |
923 #if defined(OS_WIN) | 1062 #if defined(OS_WIN) |
924 // Temporarily re-enabled to get some logs. | 1063 // Temporarily re-enabled to get some logs. |
925 #define MAYBE_PhishingLearnMore PhishingLearnMore | 1064 #define MAYBE_PhishingLearnMore PhishingLearnMore |
926 #else | 1065 #else |
927 #define MAYBE_PhishingLearnMore PhishingLearnMore | 1066 #define MAYBE_PhishingLearnMore PhishingLearnMore |
928 #endif | 1067 #endif |
929 | 1068 |
930 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MAYBE_PhishingLearnMore) { | 1069 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest, |
| 1070 MAYBE_PhishingLearnMore) { |
931 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); | 1071 SetupWarningAndNavigate(SB_THREAT_TYPE_URL_PHISHING); |
932 LOG(INFO) << "1"; | 1072 LOG(INFO) << "1"; |
933 | 1073 |
934 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); | 1074 if (GetParam() == 2) |
| 1075 EXPECT_TRUE(ClickAndWaitForDetach("learn-more-link")); |
| 1076 else |
| 1077 EXPECT_TRUE(ClickAndWaitForDetach("help-link")); |
935 LOG(INFO) << "2"; | 1078 LOG(INFO) << "2"; |
936 AssertNoInterstitial(false); // Assert the interstitial is gone | 1079 AssertNoInterstitial(false); // Assert the interstitial is gone |
937 | 1080 |
938 LOG(INFO) << "3"; | 1081 LOG(INFO) << "3"; |
939 // We are in the help page. | 1082 // We are in the help page. |
940 EXPECT_EQ( | 1083 EXPECT_EQ( |
941 "/transparencyreport/safebrowsing/", | 1084 "/transparencyreport/safebrowsing/", |
942 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); | 1085 browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path()); |
943 LOG(INFO) << "4"; | 1086 LOG(INFO) << "4"; |
944 } | 1087 } |
OLD | NEW |