| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/safe_browsing/malware_details.h" | 14 #include "chrome/browser/safe_browsing/malware_details.h" |
| 15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 15 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 23 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 24 #include "content/browser/tab_contents/navigation_controller.h" | |
| 25 #include "content/browser/tab_contents/tab_contents_view.h" | 24 #include "content/browser/tab_contents/tab_contents_view.h" |
| 25 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/test/test_browser_thread.h" | 27 #include "content/test/test_browser_thread.h" |
| 28 | 28 |
| 29 using content::BrowserThread; | 29 using content::BrowserThread; |
| 30 using content::WebContents; | 30 using content::WebContents; |
| 31 | 31 |
| 32 // A SafeBrowingService class that allows us to inject the malicious URLs. | 32 // A SafeBrowingService class that allows us to inject the malicious URLs. |
| 33 class FakeSafeBrowsingService : public SafeBrowsingService { | 33 class FakeSafeBrowsingService : public SafeBrowsingService { |
| 34 public: | 34 public: |
| 35 FakeSafeBrowsingService() {} | 35 FakeSafeBrowsingService() {} |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 SendCommand("\"proceed\""); // Simulate the user clicking "back" | 582 SendCommand("\"proceed\""); // Simulate the user clicking "back" |
| 583 AssertNoInterstitial(true); // Assert the interstitial is gone | 583 AssertNoInterstitial(true); // Assert the interstitial is gone |
| 584 | 584 |
| 585 EXPECT_EQ( | 585 EXPECT_EQ( |
| 586 url, | 586 url, |
| 587 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL()); | 587 browser()->GetSelectedTabContentsWrapper()->web_contents()->GetURL()); |
| 588 AssertReportSent(); | 588 AssertReportSent(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace | 591 } // namespace |
| OLD | NEW |