| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "components/safe_browsing_db/util.h" | 42 #include "components/safe_browsing_db/util.h" |
| 43 #include "components/security_interstitials/core/controller_client.h" | 43 #include "components/security_interstitials/core/controller_client.h" |
| 44 #include "components/security_interstitials/core/metrics_helper.h" | 44 #include "components/security_interstitials/core/metrics_helper.h" |
| 45 #include "components/security_state/core/security_state.h" | 45 #include "components/security_state/core/security_state.h" |
| 46 #include "content/public/browser/interstitial_page.h" | 46 #include "content/public/browser/interstitial_page.h" |
| 47 #include "content/public/browser/navigation_controller.h" | 47 #include "content/public/browser/navigation_controller.h" |
| 48 #include "content/public/browser/navigation_entry.h" | 48 #include "content/public/browser/navigation_entry.h" |
| 49 #include "content/public/browser/notification_types.h" | 49 #include "content/public/browser/notification_types.h" |
| 50 #include "content/public/browser/render_frame_host.h" | 50 #include "content/public/browser/render_frame_host.h" |
| 51 #include "content/public/browser/render_process_host.h" | 51 #include "content/public/browser/render_process_host.h" |
| 52 #include "content/public/browser/security_style_explanations.h" |
| 52 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
| 53 #include "content/public/test/browser_test_utils.h" | 54 #include "content/public/test/browser_test_utils.h" |
| 54 #include "content/public/test/test_browser_thread.h" | 55 #include "content/public/test/test_browser_thread.h" |
| 55 #include "content/public/test/test_utils.h" | 56 #include "content/public/test/test_utils.h" |
| 56 #include "net/cert/cert_verify_result.h" | 57 #include "net/cert/cert_verify_result.h" |
| 57 #include "net/cert/mock_cert_verifier.h" | 58 #include "net/cert/mock_cert_verifier.h" |
| 58 #include "net/test/embedded_test_server/embedded_test_server.h" | 59 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 59 #include "net/test/url_request/url_request_mock_http_job.h" | 60 #include "net/test/url_request/url_request_mock_http_job.h" |
| 60 | 61 |
| 61 using chrome_browser_interstitials::SecurityInterstitialIDNTest; | 62 using chrome_browser_interstitials::SecurityInterstitialIDNTest; |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 public: | 1117 public: |
| 1117 explicit SecurityStyleTestObserver(content::WebContents* web_contents) | 1118 explicit SecurityStyleTestObserver(content::WebContents* web_contents) |
| 1118 : content::WebContentsObserver(web_contents), | 1119 : content::WebContentsObserver(web_contents), |
| 1119 latest_security_style_(blink::WebSecurityStyleUnknown) {} | 1120 latest_security_style_(blink::WebSecurityStyleUnknown) {} |
| 1120 | 1121 |
| 1121 blink::WebSecurityStyle latest_security_style() const { | 1122 blink::WebSecurityStyle latest_security_style() const { |
| 1122 return latest_security_style_; | 1123 return latest_security_style_; |
| 1123 } | 1124 } |
| 1124 | 1125 |
| 1125 // WebContentsObserver: | 1126 // WebContentsObserver: |
| 1126 void SecurityStyleChanged(blink::WebSecurityStyle security_style, | 1127 void DidChangeVisibleSecurityState() override { |
| 1127 const content::SecurityStyleExplanations& | 1128 content::SecurityStyleExplanations security_style_explanations; |
| 1128 security_style_explanations) override { | 1129 latest_security_style_ = web_contents()->GetDelegate()->GetSecurityStyle( |
| 1129 latest_security_style_ = security_style; | 1130 web_contents(), &security_style_explanations); |
| 1130 } | 1131 } |
| 1131 | 1132 |
| 1132 private: | 1133 private: |
| 1133 blink::WebSecurityStyle latest_security_style_; | 1134 blink::WebSecurityStyle latest_security_style_; |
| 1134 DISALLOW_COPY_AND_ASSIGN(SecurityStyleTestObserver); | 1135 DISALLOW_COPY_AND_ASSIGN(SecurityStyleTestObserver); |
| 1135 }; | 1136 }; |
| 1136 | 1137 |
| 1137 } // namespace | 1138 } // namespace |
| 1138 | 1139 |
| 1139 // Test that the security indicator gets updated on a Safe Browsing | 1140 // Test that the security indicator gets updated on a Safe Browsing |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 | 1350 |
| 1350 INSTANTIATE_TEST_CASE_P( | 1351 INSTANTIATE_TEST_CASE_P( |
| 1351 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1352 SafeBrowsingBlockingPageIDNTestWithThreatType, |
| 1352 SafeBrowsingBlockingPageIDNTest, | 1353 SafeBrowsingBlockingPageIDNTest, |
| 1353 testing::Combine(testing::Values(false, true), | 1354 testing::Combine(testing::Values(false, true), |
| 1354 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1355 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
| 1355 SB_THREAT_TYPE_URL_PHISHING, | 1356 SB_THREAT_TYPE_URL_PHISHING, |
| 1356 SB_THREAT_TYPE_URL_UNWANTED))); | 1357 SB_THREAT_TYPE_URL_UNWANTED))); |
| 1357 | 1358 |
| 1358 } // namespace safe_browsing | 1359 } // namespace safe_browsing |
| OLD | NEW |