| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 423 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, |
| 424 MalwareRedirectInIFrameCanceled) { | 424 MalwareRedirectInIFrameCanceled) { |
| 425 // 1. Test the case that redirect is a subresource. | 425 // 1. Test the case that redirect is a subresource. |
| 426 MalwareRedirectCancelAndProceed("openWinIFrame"); | 426 MalwareRedirectCancelAndProceed("openWinIFrame"); |
| 427 // If the redirect was from subresource but canceled, "proceed" will continue | 427 // If the redirect was from subresource but canceled, "proceed" will continue |
| 428 // with the rest of resources. | 428 // with the rest of resources. |
| 429 AssertNoInterstitial(true); | 429 AssertNoInterstitial(true); |
| 430 } | 430 } |
| 431 | 431 |
| 432 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareRedirectCanceled) { | 432 // Disabled because of a use-after-free reported by ASan, see |
| 433 // http://crbug.com/145482. |
| 434 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, |
| 435 DISABLED_MalwareRedirectCanceled) { |
| 433 // 2. Test the case that redirect is the only resource. | 436 // 2. Test the case that redirect is the only resource. |
| 434 MalwareRedirectCancelAndProceed("openWin"); | 437 MalwareRedirectCancelAndProceed("openWin"); |
| 435 // Clicking proceed won't do anything if the main request is cancelled | 438 // Clicking proceed won't do anything if the main request is cancelled |
| 436 // already. See crbug.com/76460. | 439 // already. See crbug.com/76460. |
| 437 EXPECT_TRUE(YesInterstitial()); | 440 EXPECT_TRUE(YesInterstitial()); |
| 438 } | 441 } |
| 439 | 442 |
| 440 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) { | 443 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) { |
| 441 GURL url = test_server()->GetURL(kEmptyPage); | 444 GURL url = test_server()->GetURL(kEmptyPage); |
| 442 AddURLResult(url, SafeBrowsingService::URL_MALWARE); | 445 AddURLResult(url, SafeBrowsingService::URL_MALWARE); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 EXPECT_TRUE(GetProceedLinkIsHidden(&hidden)); | 624 EXPECT_TRUE(GetProceedLinkIsHidden(&hidden)); |
| 622 EXPECT_TRUE(hidden); | 625 EXPECT_TRUE(hidden); |
| 623 | 626 |
| 624 // The "proceed" command should go back instead, if proceeding is disabled. | 627 // The "proceed" command should go back instead, if proceeding is disabled. |
| 625 SendCommand("\"proceed\""); | 628 SendCommand("\"proceed\""); |
| 626 AssertNoInterstitial(true); | 629 AssertNoInterstitial(true); |
| 627 EXPECT_EQ( | 630 EXPECT_EQ( |
| 628 GURL(chrome::kAboutBlankURL), // Back to "about:blank" | 631 GURL(chrome::kAboutBlankURL), // Back to "about:blank" |
| 629 chrome::GetActiveWebContents(browser())->GetURL()); | 632 chrome::GetActiveWebContents(browser())->GetURL()); |
| 630 } | 633 } |
| OLD | NEW |