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