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 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/app/chrome_command_ids.h" | 25 #include "chrome/app/chrome_command_ids.h" |
26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
28 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
29 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" | 29 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 31 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
32 #include "chrome/browser/ssl/cert_report_helper.h" | 32 #include "chrome/browser/ssl/cert_report_helper.h" |
33 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 33 #include "chrome/browser/ssl/cert_verifier_browser_test.h" |
34 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" | 34 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" |
35 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | |
36 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 35 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
37 #include "chrome/browser/ssl/common_name_mismatch_handler.h" | 36 #include "chrome/browser/ssl/common_name_mismatch_handler.h" |
| 37 #include "chrome/browser/ssl/security_state_tab_helper.h" |
38 #include "chrome/browser/ssl/ssl_blocking_page.h" | 38 #include "chrome/browser/ssl/ssl_blocking_page.h" |
39 #include "chrome/browser/ssl/ssl_error_handler.h" | 39 #include "chrome/browser/ssl/ssl_error_handler.h" |
40 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
41 #include "chrome/browser/ui/browser_commands.h" | 41 #include "chrome/browser/ui/browser_commands.h" |
42 #include "chrome/browser/ui/browser_finder.h" | 42 #include "chrome/browser/ui/browser_finder.h" |
43 #include "chrome/browser/ui/browser_navigator.h" | 43 #include "chrome/browser/ui/browser_navigator.h" |
44 #include "chrome/browser/ui/browser_navigator_params.h" | 44 #include "chrome/browser/ui/browser_navigator_params.h" |
45 #include "chrome/browser/ui/browser_tabstrip.h" | 45 #include "chrome/browser/ui/browser_tabstrip.h" |
46 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
47 #include "chrome/common/chrome_paths.h" | 47 #include "chrome/common/chrome_paths.h" |
48 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
49 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
50 #include "chrome/test/base/in_process_browser_test.h" | 50 #include "chrome/test/base/in_process_browser_test.h" |
51 #include "chrome/test/base/ui_test_utils.h" | 51 #include "chrome/test/base/ui_test_utils.h" |
52 #include "components/content_settings/core/browser/host_content_settings_map.h" | 52 #include "components/content_settings/core/browser/host_content_settings_map.h" |
53 #include "components/network_time/network_time_tracker.h" | 53 #include "components/network_time/network_time_tracker.h" |
54 #include "components/prefs/pref_service.h" | 54 #include "components/prefs/pref_service.h" |
55 #include "components/security_interstitials/core/controller_client.h" | 55 #include "components/security_interstitials/core/controller_client.h" |
56 #include "components/security_interstitials/core/metrics_helper.h" | 56 #include "components/security_interstitials/core/metrics_helper.h" |
57 #include "components/security_state/security_state_model.h" | 57 #include "components/security_state/core/security_state_model.h" |
58 #include "components/security_state/switches.h" | 58 #include "components/security_state/core/switches.h" |
59 #include "components/ssl_errors/error_classification.h" | 59 #include "components/ssl_errors/error_classification.h" |
60 #include "components/variations/variations_associated_data.h" | 60 #include "components/variations/variations_associated_data.h" |
61 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 61 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
62 #include "content/public/browser/browser_context.h" | 62 #include "content/public/browser/browser_context.h" |
63 #include "content/public/browser/interstitial_page.h" | 63 #include "content/public/browser/interstitial_page.h" |
64 #include "content/public/browser/navigation_controller.h" | 64 #include "content/public/browser/navigation_controller.h" |
65 #include "content/public/browser/navigation_entry.h" | 65 #include "content/public/browser/navigation_entry.h" |
66 #include "content/public/browser/notification_details.h" | 66 #include "content/public/browser/notification_details.h" |
67 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
68 #include "content/public/browser/render_frame_host.h" | 68 #include "content/public/browser/render_frame_host.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 ran_insecure_content); | 155 ran_insecure_content); |
156 } | 156 } |
157 | 157 |
158 } // namespace AuthState | 158 } // namespace AuthState |
159 | 159 |
160 namespace SecurityStyle { | 160 namespace SecurityStyle { |
161 | 161 |
162 void Check( | 162 void Check( |
163 WebContents* tab, | 163 WebContents* tab, |
164 security_state::SecurityStateModel::SecurityLevel expected_security_level) { | 164 security_state::SecurityStateModel::SecurityLevel expected_security_level) { |
165 ChromeSecurityStateModelClient* model_client = | 165 SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(tab); |
166 ChromeSecurityStateModelClient::FromWebContents(tab); | |
167 security_state::SecurityStateModel::SecurityInfo security_info; | 166 security_state::SecurityStateModel::SecurityInfo security_info; |
168 model_client->GetSecurityInfo(&security_info); | 167 helper->GetSecurityInfo(&security_info); |
169 EXPECT_EQ(expected_security_level, security_info.security_level); | 168 EXPECT_EQ(expected_security_level, security_info.security_level); |
170 } | 169 } |
171 | 170 |
172 } // namespace SecurityStyle | 171 } // namespace SecurityStyle |
173 | 172 |
174 namespace CertError { | 173 namespace CertError { |
175 | 174 |
176 enum CertErrorFlags { | 175 enum CertErrorFlags { |
177 NONE = 0 | 176 NONE = 0 |
178 }; | 177 }; |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 // MarkNonSecureAs field trial is enabled. | 1193 // MarkNonSecureAs field trial is enabled. |
1195 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) { | 1194 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) { |
1196 scoped_refptr<base::FieldTrial> trial = | 1195 scoped_refptr<base::FieldTrial> trial = |
1197 base::FieldTrialList::CreateFieldTrial( | 1196 base::FieldTrialList::CreateFieldTrial( |
1198 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); | 1197 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); |
1199 | 1198 |
1200 content::WebContents* contents = | 1199 content::WebContents* contents = |
1201 browser()->tab_strip_model()->GetActiveWebContents(); | 1200 browser()->tab_strip_model()->GetActiveWebContents(); |
1202 ASSERT_TRUE(contents); | 1201 ASSERT_TRUE(contents); |
1203 | 1202 |
1204 ChromeSecurityStateModelClient* model_client = | 1203 SecurityStateTabHelper* helper = |
1205 ChromeSecurityStateModelClient::FromWebContents(contents); | 1204 SecurityStateTabHelper::FromWebContents(contents); |
1206 ASSERT_TRUE(model_client); | 1205 ASSERT_TRUE(helper); |
1207 | 1206 |
1208 ui_test_utils::NavigateToURL(browser(), GURL("file:///")); | 1207 ui_test_utils::NavigateToURL(browser(), GURL("file:///")); |
1209 security_state::SecurityStateModel::SecurityInfo security_info; | 1208 security_state::SecurityStateModel::SecurityInfo security_info; |
1210 model_client->GetSecurityInfo(&security_info); | 1209 helper->GetSecurityInfo(&security_info); |
1211 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 1210 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
1212 security_info.security_level); | 1211 security_info.security_level); |
1213 } | 1212 } |
1214 | 1213 |
1215 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkAboutAsNonSecure) { | 1214 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkAboutAsNonSecure) { |
1216 scoped_refptr<base::FieldTrial> trial = | 1215 scoped_refptr<base::FieldTrial> trial = |
1217 base::FieldTrialList::CreateFieldTrial( | 1216 base::FieldTrialList::CreateFieldTrial( |
1218 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); | 1217 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); |
1219 | 1218 |
1220 content::WebContents* contents = | 1219 content::WebContents* contents = |
1221 browser()->tab_strip_model()->GetActiveWebContents(); | 1220 browser()->tab_strip_model()->GetActiveWebContents(); |
1222 ASSERT_TRUE(contents); | 1221 ASSERT_TRUE(contents); |
1223 | 1222 |
1224 ChromeSecurityStateModelClient* model_client = | 1223 SecurityStateTabHelper* helper = |
1225 ChromeSecurityStateModelClient::FromWebContents(contents); | 1224 SecurityStateTabHelper::FromWebContents(contents); |
1226 ASSERT_TRUE(model_client); | 1225 ASSERT_TRUE(helper); |
1227 | 1226 |
1228 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 1227 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
1229 security_state::SecurityStateModel::SecurityInfo security_info; | 1228 security_state::SecurityStateModel::SecurityInfo security_info; |
1230 model_client->GetSecurityInfo(&security_info); | 1229 helper->GetSecurityInfo(&security_info); |
1231 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 1230 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
1232 security_info.security_level); | 1231 security_info.security_level); |
1233 } | 1232 } |
1234 | 1233 |
1235 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkDataAsNonSecure) { | 1234 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkDataAsNonSecure) { |
1236 scoped_refptr<base::FieldTrial> trial = | 1235 scoped_refptr<base::FieldTrial> trial = |
1237 base::FieldTrialList::CreateFieldTrial( | 1236 base::FieldTrialList::CreateFieldTrial( |
1238 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); | 1237 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); |
1239 | 1238 |
1240 content::WebContents* contents = | 1239 content::WebContents* contents = |
1241 browser()->tab_strip_model()->GetActiveWebContents(); | 1240 browser()->tab_strip_model()->GetActiveWebContents(); |
1242 ASSERT_TRUE(contents); | 1241 ASSERT_TRUE(contents); |
1243 | 1242 |
1244 ChromeSecurityStateModelClient* model_client = | 1243 SecurityStateTabHelper* helper = |
1245 ChromeSecurityStateModelClient::FromWebContents(contents); | 1244 SecurityStateTabHelper::FromWebContents(contents); |
1246 ASSERT_TRUE(model_client); | 1245 ASSERT_TRUE(helper); |
1247 | 1246 |
1248 ui_test_utils::NavigateToURL(browser(), GURL("data:text/plain,hello")); | 1247 ui_test_utils::NavigateToURL(browser(), GURL("data:text/plain,hello")); |
1249 security_state::SecurityStateModel::SecurityInfo security_info; | 1248 security_state::SecurityStateModel::SecurityInfo security_info; |
1250 model_client->GetSecurityInfo(&security_info); | 1249 helper->GetSecurityInfo(&security_info); |
1251 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 1250 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
1252 security_info.security_level); | 1251 security_info.security_level); |
1253 } | 1252 } |
1254 | 1253 |
1255 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkBlobAsNonSecure) { | 1254 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkBlobAsNonSecure) { |
1256 scoped_refptr<base::FieldTrial> trial = | 1255 scoped_refptr<base::FieldTrial> trial = |
1257 base::FieldTrialList::CreateFieldTrial( | 1256 base::FieldTrialList::CreateFieldTrial( |
1258 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); | 1257 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); |
1259 | 1258 |
1260 content::WebContents* contents = | 1259 content::WebContents* contents = |
1261 browser()->tab_strip_model()->GetActiveWebContents(); | 1260 browser()->tab_strip_model()->GetActiveWebContents(); |
1262 ASSERT_TRUE(contents); | 1261 ASSERT_TRUE(contents); |
1263 | 1262 |
1264 ChromeSecurityStateModelClient* model_client = | 1263 SecurityStateTabHelper* helper = |
1265 ChromeSecurityStateModelClient::FromWebContents(contents); | 1264 SecurityStateTabHelper::FromWebContents(contents); |
1266 ASSERT_TRUE(model_client); | 1265 ASSERT_TRUE(helper); |
1267 | 1266 |
1268 ui_test_utils::NavigateToURL( | 1267 ui_test_utils::NavigateToURL( |
1269 browser(), | 1268 browser(), |
1270 GURL("blob:chrome://newtab/49a463bb-fac8-476c-97bf-5d7076c3ea1a")); | 1269 GURL("blob:chrome://newtab/49a463bb-fac8-476c-97bf-5d7076c3ea1a")); |
1271 security_state::SecurityStateModel::SecurityInfo security_info; | 1270 security_state::SecurityStateModel::SecurityInfo security_info; |
1272 model_client->GetSecurityInfo(&security_info); | 1271 helper->GetSecurityInfo(&security_info); |
1273 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 1272 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
1274 security_info.security_level); | 1273 security_info.security_level); |
1275 } | 1274 } |
1276 | 1275 |
1277 #if defined(USE_NSS_CERTS) | 1276 #if defined(USE_NSS_CERTS) |
1278 class SSLUITestWithClientCert : public SSLUITest { | 1277 class SSLUITestWithClientCert : public SSLUITest { |
1279 public: | 1278 public: |
1280 SSLUITestWithClientCert() : cert_db_(NULL) {} | 1279 SSLUITestWithClientCert() : cert_db_(NULL) {} |
1281 | 1280 |
1282 void SetUpOnMainThread() override { | 1281 void SetUpOnMainThread() override { |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2452 // the user approves the bad certificate. | 2451 // the user approves the bad certificate. |
2453 ui_test_utils::NavigateToURL( | 2452 ui_test_utils::NavigateToURL( |
2454 browser(), https_server_mismatched_.GetURL("/ssl/blank_page.html")); | 2453 browser(), https_server_mismatched_.GetURL("/ssl/blank_page.html")); |
2455 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2454 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2456 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 2455 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
2457 AuthState::SHOWING_INTERSTITIAL); | 2456 AuthState::SHOWING_INTERSTITIAL); |
2458 ProceedThroughInterstitial(tab); | 2457 ProceedThroughInterstitial(tab); |
2459 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 2458 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
2460 AuthState::NONE); | 2459 AuthState::NONE); |
2461 | 2460 |
2462 ChromeSecurityStateModelClient* client = | 2461 SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(tab); |
2463 ChromeSecurityStateModelClient::FromWebContents(tab); | 2462 ASSERT_TRUE(helper); |
2464 ASSERT_TRUE(client); | |
2465 security_state::SecurityStateModel::SecurityInfo security_info; | 2463 security_state::SecurityStateModel::SecurityInfo security_info; |
2466 client->GetSecurityInfo(&security_info); | 2464 helper->GetSecurityInfo(&security_info); |
2467 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2465 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2468 security_info.mixed_content_status); | 2466 security_info.mixed_content_status); |
2469 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2467 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2470 security_info.content_with_cert_errors_status); | 2468 security_info.content_with_cert_errors_status); |
2471 | 2469 |
2472 // Navigate to safe page that has Worker loading unsafe content. | 2470 // Navigate to safe page that has Worker loading unsafe content. |
2473 // Expect content to load but be marked as auth broken due to running insecure | 2471 // Expect content to load but be marked as auth broken due to running insecure |
2474 // content. | 2472 // content. |
2475 std::string page_with_unsafe_worker_path; | 2473 std::string page_with_unsafe_worker_path; |
2476 GetPageWithUnsafeWorkerPath(https_server_mismatched_, | 2474 GetPageWithUnsafeWorkerPath(https_server_mismatched_, |
2477 &page_with_unsafe_worker_path); | 2475 &page_with_unsafe_worker_path); |
2478 ui_test_utils::NavigateToURL( | 2476 ui_test_utils::NavigateToURL( |
2479 browser(), https_server_.GetURL(page_with_unsafe_worker_path)); | 2477 browser(), https_server_.GetURL(page_with_unsafe_worker_path)); |
2480 CheckWorkerLoadResult(tab, true); // Worker loads insecure content | 2478 CheckWorkerLoadResult(tab, true); // Worker loads insecure content |
2481 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); | 2479 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); |
2482 | 2480 |
2483 client->GetSecurityInfo(&security_info); | 2481 helper->GetSecurityInfo(&security_info); |
2484 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2482 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2485 security_info.mixed_content_status); | 2483 security_info.mixed_content_status); |
2486 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_RAN, | 2484 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_RAN, |
2487 security_info.content_with_cert_errors_status); | 2485 security_info.content_with_cert_errors_status); |
2488 } | 2486 } |
2489 | 2487 |
2490 // Visits a page with unsafe content and makes sure that if a user exception to | 2488 // Visits a page with unsafe content and makes sure that if a user exception to |
2491 // the certificate error is present, the image is loaded and script executes. | 2489 // the certificate error is present, the image is loaded and script executes. |
2492 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) { | 2490 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) { |
2493 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2491 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2494 ASSERT_NO_FATAL_FAILURE(SetUpUnsafeContentsWithUserException( | 2492 ASSERT_NO_FATAL_FAILURE(SetUpUnsafeContentsWithUserException( |
2495 "/ssl/page_with_unsafe_contents.html")); | 2493 "/ssl/page_with_unsafe_contents.html")); |
2496 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); | 2494 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); |
2497 | 2495 |
2498 ChromeSecurityStateModelClient* client = | 2496 SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(tab); |
2499 ChromeSecurityStateModelClient::FromWebContents(tab); | 2497 ASSERT_TRUE(helper); |
2500 ASSERT_TRUE(client); | |
2501 security_state::SecurityStateModel::SecurityInfo security_info; | 2498 security_state::SecurityStateModel::SecurityInfo security_info; |
2502 client->GetSecurityInfo(&security_info); | 2499 helper->GetSecurityInfo(&security_info); |
2503 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2500 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2504 security_info.mixed_content_status); | 2501 security_info.mixed_content_status); |
2505 EXPECT_EQ( | 2502 EXPECT_EQ( |
2506 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, | 2503 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, |
2507 security_info.content_with_cert_errors_status); | 2504 security_info.content_with_cert_errors_status); |
2508 | 2505 |
2509 int img_width; | 2506 int img_width; |
2510 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 2507 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
2511 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); | 2508 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); |
2512 // In order to check that the image was loaded, we check its width. | 2509 // In order to check that the image was loaded, we check its width. |
(...skipping 14 matching lines...) Expand all Loading... |
2527 https_server_mismatched_.host_port_pair(), &replacement_path); | 2524 https_server_mismatched_.host_port_pair(), &replacement_path); |
2528 ui_test_utils::NavigateToURL( | 2525 ui_test_utils::NavigateToURL( |
2529 browser(), https_server_mismatched_.GetURL(replacement_path)); | 2526 browser(), https_server_mismatched_.GetURL(replacement_path)); |
2530 js_result = false; | 2527 js_result = false; |
2531 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 2528 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
2532 tab, "window.domAutomationController.send(IsFooSet());", &js_result)); | 2529 tab, "window.domAutomationController.send(IsFooSet());", &js_result)); |
2533 EXPECT_TRUE(js_result); | 2530 EXPECT_TRUE(js_result); |
2534 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, | 2531 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, |
2535 AuthState::NONE); | 2532 AuthState::NONE); |
2536 | 2533 |
2537 client->GetSecurityInfo(&security_info); | 2534 helper->GetSecurityInfo(&security_info); |
2538 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2535 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2539 security_info.mixed_content_status); | 2536 security_info.mixed_content_status); |
2540 EXPECT_EQ( | 2537 EXPECT_EQ( |
2541 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, | 2538 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, |
2542 security_info.content_with_cert_errors_status); | 2539 security_info.content_with_cert_errors_status); |
2543 } | 2540 } |
2544 | 2541 |
2545 // Like the test above, but only displaying inactive content (an image). | 2542 // Like the test above, but only displaying inactive content (an image). |
2546 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) { | 2543 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) { |
2547 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2544 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2548 ASSERT_NO_FATAL_FAILURE( | 2545 ASSERT_NO_FATAL_FAILURE( |
2549 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html")); | 2546 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html")); |
2550 | 2547 |
2551 ChromeSecurityStateModelClient* client = | 2548 SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(tab); |
2552 ChromeSecurityStateModelClient::FromWebContents(tab); | 2549 ASSERT_TRUE(helper); |
2553 ASSERT_TRUE(client); | |
2554 security_state::SecurityStateModel::SecurityInfo security_info; | 2550 security_state::SecurityStateModel::SecurityInfo security_info; |
2555 client->GetSecurityInfo(&security_info); | 2551 helper->GetSecurityInfo(&security_info); |
2556 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2552 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
2557 security_info.mixed_content_status); | 2553 security_info.mixed_content_status); |
2558 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED, | 2554 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED, |
2559 security_info.content_with_cert_errors_status); | 2555 security_info.content_with_cert_errors_status); |
2560 EXPECT_EQ(security_state::SecurityStateModel::NONE, | 2556 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
2561 security_info.security_level); | 2557 security_info.security_level); |
2562 EXPECT_EQ(0u, security_info.cert_status); | 2558 EXPECT_EQ(0u, security_info.cert_status); |
2563 | 2559 |
2564 int img_width; | 2560 int img_width; |
2565 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 2561 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3410 | 3406 |
3411 // Visit a page over https that contains a frame with a redirect. | 3407 // Visit a page over https that contains a frame with a redirect. |
3412 | 3408 |
3413 // XMLHttpRequest insecure content in synchronous mode. | 3409 // XMLHttpRequest insecure content in synchronous mode. |
3414 | 3410 |
3415 // XMLHttpRequest insecure content in asynchronous mode. | 3411 // XMLHttpRequest insecure content in asynchronous mode. |
3416 | 3412 |
3417 // XMLHttpRequest over bad ssl in synchronous mode. | 3413 // XMLHttpRequest over bad ssl in synchronous mode. |
3418 | 3414 |
3419 // XMLHttpRequest over OK ssl in synchronous mode. | 3415 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |