| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 ui_test_utils::NavigateToURL(browser(), url); | 288 ui_test_utils::NavigateToURL(browser(), url); |
| 289 | 289 |
| 290 SendCommand("\"proceed\""); // Simulate the user clicking "proceed" | 290 SendCommand("\"proceed\""); // Simulate the user clicking "proceed" |
| 291 AssertNoInterstitial(); // Assert the interstitial is gone | 291 AssertNoInterstitial(); // Assert the interstitial is gone |
| 292 | 292 |
| 293 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); | 293 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, | 296 IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, |
| 297 MalwareIframeReportDetails) { | 297 MalwareIframeReportDetails) { |
| 298 // Enable reporting of malware details. | |
| 299 browser()->GetProfile()->GetPrefs()->SetBoolean( | |
| 300 prefs::kSafeBrowsingReportingEnabled, true); | |
| 301 EXPECT_TRUE(browser()->GetProfile()->GetPrefs()->GetBoolean( | |
| 302 prefs::kSafeBrowsingReportingEnabled)); | |
| 303 | |
| 304 GURL url = test_server()->GetURL(kMalwarePage); | 298 GURL url = test_server()->GetURL(kMalwarePage); |
| 305 GURL iframe_url = test_server()->GetURL(kMalwareIframe); | 299 GURL iframe_url = test_server()->GetURL(kMalwareIframe); |
| 306 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE); | 300 AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE); |
| 307 | 301 |
| 308 ui_test_utils::NavigateToURL(browser(), url); | 302 ui_test_utils::NavigateToURL(browser(), url); |
| 309 | 303 |
| 310 SendCommand("\"proceed\""); // Simulate the user clicking "back" | 304 SendCommand("\"doReport\""); // Simulate the user checking the checkbox. |
| 305 EXPECT_TRUE(browser()->GetProfile()->GetPrefs()->GetBoolean( |
| 306 prefs::kSafeBrowsingReportingEnabled)); |
| 307 |
| 308 SendCommand("\"proceed\""); // Simulate the user clicking "back" |
| 311 AssertNoInterstitial(); // Assert the interstitial is gone | 309 AssertNoInterstitial(); // Assert the interstitial is gone |
| 312 | 310 |
| 313 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); | 311 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); |
| 314 AssertReportSent(); | 312 AssertReportSent(); |
| 315 } | 313 } |
| 316 | 314 |
| 317 } // namespace | 315 } // namespace |
| OLD | NEW |