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 "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 TabContents* contents = browser()->GetSelectedTabContents(); | 308 TabContents* contents = browser()->GetSelectedTabContents(); |
309 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( | 309 InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage( |
310 contents); | 310 contents); |
311 return interstitial_page != NULL; | 311 return interstitial_page != NULL; |
312 } | 312 } |
313 | 313 |
314 void WaitForInterstitial() { | 314 void WaitForInterstitial() { |
315 TabContents* contents = browser()->GetSelectedTabContents(); | 315 TabContents* contents = browser()->GetSelectedTabContents(); |
316 if (!InterstitialPage::GetInterstitialPage(contents)) | 316 if (!InterstitialPage::GetInterstitialPage(contents)) |
317 ui_test_utils::WaitForNotificationFrom( | 317 ui_test_utils::WaitForNotificationFrom( |
318 NotificationType::INTERSTITIAL_ATTACHED, | 318 content::NOTIFICATION_INTERSTITIAL_ATTACHED, |
319 Source<TabContents>(contents)); | 319 Source<TabContents>(contents)); |
320 } | 320 } |
321 | 321 |
322 void WaitForNavigation() { | 322 void WaitForNavigation() { |
323 NavigationController* controller = | 323 NavigationController* controller = |
324 &browser()->GetSelectedTabContents()->controller(); | 324 &browser()->GetSelectedTabContents()->controller(); |
325 ui_test_utils::WaitForNavigation(controller); | 325 ui_test_utils::WaitForNavigation(controller); |
326 } | 326 } |
327 | 327 |
328 void AssertReportSent() { | 328 void AssertReportSent() { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 prefs::kSafeBrowsingReportingEnabled)); | 535 prefs::kSafeBrowsingReportingEnabled)); |
536 | 536 |
537 SendCommand("\"proceed\""); // Simulate the user clicking "back" | 537 SendCommand("\"proceed\""); // Simulate the user clicking "back" |
538 AssertNoInterstitial(true); // Assert the interstitial is gone | 538 AssertNoInterstitial(true); // Assert the interstitial is gone |
539 | 539 |
540 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); | 540 EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); |
541 AssertReportSent(); | 541 AssertReportSent(); |
542 } | 542 } |
543 | 543 |
544 } // namespace | 544 } // namespace |
OLD | NEW |