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 known- | 5 // This test creates a fake safebrowsing service, where we can inject known- |
6 // threat urls. It then uses a real browser to go to these urls, and sends | 6 // threat urls. It then uses a real browser to go to these urls, and sends |
7 // "goback" or "proceed" commands and verifies they work. | 7 // "goback" or "proceed" commands and verifies they work. |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 GURL load_url = net::URLRequestMockHTTPJob::GetMockUrl( | 447 GURL load_url = net::URLRequestMockHTTPJob::GetMockUrl( |
448 "safe_browsing/interstitial_cancel.html"); | 448 "safe_browsing/interstitial_cancel.html"); |
449 GURL malware_url = net::URLRequestMockHTTPJob::GetMockUrl(kMalwarePage); | 449 GURL malware_url = net::URLRequestMockHTTPJob::GetMockUrl(kMalwarePage); |
450 SetURLThreatType(malware_url, testing::get<0>(GetParam())); | 450 SetURLThreatType(malware_url, testing::get<0>(GetParam())); |
451 | 451 |
452 // Load the test page. | 452 // Load the test page. |
453 ui_test_utils::NavigateToURL(browser(), load_url); | 453 ui_test_utils::NavigateToURL(browser(), load_url); |
454 // Trigger the safe browsing interstitial page via a redirect in | 454 // Trigger the safe browsing interstitial page via a redirect in |
455 // "openWin()". | 455 // "openWin()". |
456 ui_test_utils::NavigateToURLWithDisposition( | 456 ui_test_utils::NavigateToURLWithDisposition( |
457 browser(), | 457 browser(), GURL("javascript:" + open_function + "()"), |
458 GURL("javascript:" + open_function + "()"), | 458 WindowOpenDisposition::CURRENT_TAB, |
459 CURRENT_TAB, | |
460 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 459 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
461 WebContents* contents = | 460 WebContents* contents = |
462 browser()->tab_strip_model()->GetActiveWebContents(); | 461 browser()->tab_strip_model()->GetActiveWebContents(); |
463 content::WaitForInterstitialAttach(contents); | 462 content::WaitForInterstitialAttach(contents); |
464 // Cancel the redirect request while interstitial page is open. | 463 // Cancel the redirect request while interstitial page is open. |
465 browser()->tab_strip_model()->ActivateTabAt(0, true); | 464 browser()->tab_strip_model()->ActivateTabAt(0, true); |
466 ui_test_utils::NavigateToURL(browser(), GURL("javascript:stopWin()")); | 465 ui_test_utils::NavigateToURL(browser(), GURL("javascript:stopWin()")); |
467 browser()->tab_strip_model()->ActivateTabAt(1, true); | 466 browser()->tab_strip_model()->ActivateTabAt(1, true); |
468 // Simulate the user clicking "proceed", there should be no crash. Since | 467 // Simulate the user clicking "proceed", there should be no crash. Since |
469 // clicking proceed may do nothing (see comment in RedirectCanceled | 468 // clicking proceed may do nothing (see comment in RedirectCanceled |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 | 1160 |
1162 INSTANTIATE_TEST_CASE_P( | 1161 INSTANTIATE_TEST_CASE_P( |
1163 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1162 SafeBrowsingBlockingPageIDNTestWithThreatType, |
1164 SafeBrowsingBlockingPageIDNTest, | 1163 SafeBrowsingBlockingPageIDNTest, |
1165 testing::Combine(testing::Values(false, true), | 1164 testing::Combine(testing::Values(false, true), |
1166 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1165 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
1167 SB_THREAT_TYPE_URL_PHISHING, | 1166 SB_THREAT_TYPE_URL_PHISHING, |
1168 SB_THREAT_TYPE_URL_UNWANTED))); | 1167 SB_THREAT_TYPE_URL_UNWANTED))); |
1169 | 1168 |
1170 } // namespace safe_browsing | 1169 } // namespace safe_browsing |
OLD | NEW |