| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 FakeMalwareDetails* get_details() { | 177 FakeMalwareDetails* get_details() { |
| 178 return details_; | 178 return details_; |
| 179 } | 179 } |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 FakeMalwareDetails* details_; | 182 FakeMalwareDetails* details_; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. | 185 // A SafeBrowingBlockingPage class that lets us wait until it's hidden. |
| 186 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { | 186 class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPageV1 { |
| 187 public: | 187 public: |
| 188 TestSafeBrowsingBlockingPage(SafeBrowsingService* service, | 188 TestSafeBrowsingBlockingPage(SafeBrowsingService* service, |
| 189 WebContents* web_contents, | 189 WebContents* web_contents, |
| 190 const UnsafeResourceList& unsafe_resources) | 190 const UnsafeResourceList& unsafe_resources) |
| 191 : SafeBrowsingBlockingPage(service, web_contents, unsafe_resources), | 191 : SafeBrowsingBlockingPageV1(service, web_contents, unsafe_resources), |
| 192 wait_for_delete_(false) { | 192 wait_for_delete_(false) { |
| 193 // Don't wait the whole 3 seconds for the browser test. | 193 // Don't wait the whole 3 seconds for the browser test. |
| 194 malware_details_proceed_delay_ms_ = 100; | 194 malware_details_proceed_delay_ms_ = 100; |
| 195 } | 195 } |
| 196 | 196 |
| 197 ~TestSafeBrowsingBlockingPage() { | 197 ~TestSafeBrowsingBlockingPage() { |
| 198 if (!wait_for_delete_) | 198 if (!wait_for_delete_) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 // Notify that we are gone | 201 // Notify that we are gone |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 EXPECT_TRUE(GetProceedLinkIsHidden(&hidden)); | 621 EXPECT_TRUE(GetProceedLinkIsHidden(&hidden)); |
| 622 EXPECT_TRUE(hidden); | 622 EXPECT_TRUE(hidden); |
| 623 | 623 |
| 624 // The "proceed" command should go back instead, if proceeding is disabled. | 624 // The "proceed" command should go back instead, if proceeding is disabled. |
| 625 SendCommand("\"proceed\""); | 625 SendCommand("\"proceed\""); |
| 626 AssertNoInterstitial(true); | 626 AssertNoInterstitial(true); |
| 627 EXPECT_EQ( | 627 EXPECT_EQ( |
| 628 GURL(chrome::kAboutBlankURL), // Back to "about:blank" | 628 GURL(chrome::kAboutBlankURL), // Back to "about:blank" |
| 629 chrome::GetActiveWebContents(browser())->GetURL()); | 629 chrome::GetActiveWebContents(browser())->GetURL()); |
| 630 } | 630 } |
| OLD | NEW |