Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2448943002: Refactor SecurityStateModel/Clients for simplicity and reusability. (Closed)
Patch Set: Remove *SecurityModelClient. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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" 35 #include "chrome/browser/ssl/chrome_security_state_model.h"
36 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 36 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
37 #include "chrome/browser/ssl/common_name_mismatch_handler.h" 37 #include "chrome/browser/ssl/common_name_mismatch_handler.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
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 ChromeSecurityStateModel* model =
166 ChromeSecurityStateModelClient::FromWebContents(tab); 166 ChromeSecurityStateModel::FromWebContents(tab);
167 security_state::SecurityStateModel::SecurityInfo security_info; 167 security_state::SecurityStateModel::SecurityInfo security_info;
168 model_client->GetSecurityInfo(&security_info); 168 model->GetSecurityInfo(&security_info);
169 EXPECT_EQ(expected_security_level, security_info.security_level); 169 EXPECT_EQ(expected_security_level, security_info.security_level);
170 } 170 }
171 171
172 } // namespace SecurityStyle 172 } // namespace SecurityStyle
173 173
174 namespace CertError { 174 namespace CertError {
175 175
176 enum CertErrorFlags { 176 enum CertErrorFlags {
177 NONE = 0 177 NONE = 0
178 }; 178 };
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 // MarkNonSecureAs field trial is enabled. 1194 // MarkNonSecureAs field trial is enabled.
1195 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) { 1195 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) {
1196 scoped_refptr<base::FieldTrial> trial = 1196 scoped_refptr<base::FieldTrial> trial =
1197 base::FieldTrialList::CreateFieldTrial( 1197 base::FieldTrialList::CreateFieldTrial(
1198 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); 1198 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
1199 1199
1200 content::WebContents* contents = 1200 content::WebContents* contents =
1201 browser()->tab_strip_model()->GetActiveWebContents(); 1201 browser()->tab_strip_model()->GetActiveWebContents();
1202 ASSERT_TRUE(contents); 1202 ASSERT_TRUE(contents);
1203 1203
1204 ChromeSecurityStateModelClient* model_client = 1204 ChromeSecurityStateModel* model =
1205 ChromeSecurityStateModelClient::FromWebContents(contents); 1205 ChromeSecurityStateModel::FromWebContents(contents);
1206 ASSERT_TRUE(model_client); 1206 ASSERT_TRUE(model);
1207 1207
1208 ui_test_utils::NavigateToURL(browser(), GURL("file:///")); 1208 ui_test_utils::NavigateToURL(browser(), GURL("file:///"));
1209 security_state::SecurityStateModel::SecurityInfo security_info; 1209 security_state::SecurityStateModel::SecurityInfo security_info;
1210 model_client->GetSecurityInfo(&security_info); 1210 model->GetSecurityInfo(&security_info);
1211 EXPECT_EQ(security_state::SecurityStateModel::NONE, 1211 EXPECT_EQ(security_state::SecurityStateModel::NONE,
1212 security_info.security_level); 1212 security_info.security_level);
1213 } 1213 }
1214 1214
1215 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkAboutAsNonSecure) { 1215 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkAboutAsNonSecure) {
1216 scoped_refptr<base::FieldTrial> trial = 1216 scoped_refptr<base::FieldTrial> trial =
1217 base::FieldTrialList::CreateFieldTrial( 1217 base::FieldTrialList::CreateFieldTrial(
1218 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); 1218 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
1219 1219
1220 content::WebContents* contents = 1220 content::WebContents* contents =
1221 browser()->tab_strip_model()->GetActiveWebContents(); 1221 browser()->tab_strip_model()->GetActiveWebContents();
1222 ASSERT_TRUE(contents); 1222 ASSERT_TRUE(contents);
1223 1223
1224 ChromeSecurityStateModelClient* model_client = 1224 ChromeSecurityStateModel* model =
1225 ChromeSecurityStateModelClient::FromWebContents(contents); 1225 ChromeSecurityStateModel::FromWebContents(contents);
1226 ASSERT_TRUE(model_client); 1226 ASSERT_TRUE(model);
1227 1227
1228 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 1228 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
1229 security_state::SecurityStateModel::SecurityInfo security_info; 1229 security_state::SecurityStateModel::SecurityInfo security_info;
1230 model_client->GetSecurityInfo(&security_info); 1230 model->GetSecurityInfo(&security_info);
1231 EXPECT_EQ(security_state::SecurityStateModel::NONE, 1231 EXPECT_EQ(security_state::SecurityStateModel::NONE,
1232 security_info.security_level); 1232 security_info.security_level);
1233 } 1233 }
1234 1234
1235 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkDataAsNonSecure) { 1235 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkDataAsNonSecure) {
1236 scoped_refptr<base::FieldTrial> trial = 1236 scoped_refptr<base::FieldTrial> trial =
1237 base::FieldTrialList::CreateFieldTrial( 1237 base::FieldTrialList::CreateFieldTrial(
1238 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); 1238 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
1239 1239
1240 content::WebContents* contents = 1240 content::WebContents* contents =
1241 browser()->tab_strip_model()->GetActiveWebContents(); 1241 browser()->tab_strip_model()->GetActiveWebContents();
1242 ASSERT_TRUE(contents); 1242 ASSERT_TRUE(contents);
1243 1243
1244 ChromeSecurityStateModelClient* model_client = 1244 ChromeSecurityStateModel* model =
1245 ChromeSecurityStateModelClient::FromWebContents(contents); 1245 ChromeSecurityStateModel::FromWebContents(contents);
1246 ASSERT_TRUE(model_client); 1246 ASSERT_TRUE(model);
1247 1247
1248 ui_test_utils::NavigateToURL(browser(), GURL("data:text/plain,hello")); 1248 ui_test_utils::NavigateToURL(browser(), GURL("data:text/plain,hello"));
1249 security_state::SecurityStateModel::SecurityInfo security_info; 1249 security_state::SecurityStateModel::SecurityInfo security_info;
1250 model_client->GetSecurityInfo(&security_info); 1250 model->GetSecurityInfo(&security_info);
1251 EXPECT_EQ(security_state::SecurityStateModel::NONE, 1251 EXPECT_EQ(security_state::SecurityStateModel::NONE,
1252 security_info.security_level); 1252 security_info.security_level);
1253 } 1253 }
1254 1254
1255 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkBlobAsNonSecure) { 1255 IN_PROC_BROWSER_TEST_F(SSLUITest, MarkBlobAsNonSecure) {
1256 scoped_refptr<base::FieldTrial> trial = 1256 scoped_refptr<base::FieldTrial> trial =
1257 base::FieldTrialList::CreateFieldTrial( 1257 base::FieldTrialList::CreateFieldTrial(
1258 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous); 1258 "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
1259 1259
1260 content::WebContents* contents = 1260 content::WebContents* contents =
1261 browser()->tab_strip_model()->GetActiveWebContents(); 1261 browser()->tab_strip_model()->GetActiveWebContents();
1262 ASSERT_TRUE(contents); 1262 ASSERT_TRUE(contents);
1263 1263
1264 ChromeSecurityStateModelClient* model_client = 1264 ChromeSecurityStateModel* model =
1265 ChromeSecurityStateModelClient::FromWebContents(contents); 1265 ChromeSecurityStateModel::FromWebContents(contents);
1266 ASSERT_TRUE(model_client); 1266 ASSERT_TRUE(model);
1267 1267
1268 ui_test_utils::NavigateToURL( 1268 ui_test_utils::NavigateToURL(
1269 browser(), 1269 browser(),
1270 GURL("blob:chrome://newtab/49a463bb-fac8-476c-97bf-5d7076c3ea1a")); 1270 GURL("blob:chrome://newtab/49a463bb-fac8-476c-97bf-5d7076c3ea1a"));
1271 security_state::SecurityStateModel::SecurityInfo security_info; 1271 security_state::SecurityStateModel::SecurityInfo security_info;
1272 model_client->GetSecurityInfo(&security_info); 1272 model->GetSecurityInfo(&security_info);
1273 EXPECT_EQ(security_state::SecurityStateModel::NONE, 1273 EXPECT_EQ(security_state::SecurityStateModel::NONE,
1274 security_info.security_level); 1274 security_info.security_level);
1275 } 1275 }
1276 1276
1277 #if defined(USE_NSS_CERTS) 1277 #if defined(USE_NSS_CERTS)
1278 class SSLUITestWithClientCert : public SSLUITest { 1278 class SSLUITestWithClientCert : public SSLUITest {
1279 public: 1279 public:
1280 SSLUITestWithClientCert() : cert_db_(NULL) {} 1280 SSLUITestWithClientCert() : cert_db_(NULL) {}
1281 1281
1282 void SetUpOnMainThread() override { 1282 void SetUpOnMainThread() override {
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 // the user approves the bad certificate. 2452 // the user approves the bad certificate.
2453 ui_test_utils::NavigateToURL( 2453 ui_test_utils::NavigateToURL(
2454 browser(), https_server_mismatched_.GetURL("/ssl/blank_page.html")); 2454 browser(), https_server_mismatched_.GetURL("/ssl/blank_page.html"));
2455 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2455 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2456 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 2456 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2457 AuthState::SHOWING_INTERSTITIAL); 2457 AuthState::SHOWING_INTERSTITIAL);
2458 ProceedThroughInterstitial(tab); 2458 ProceedThroughInterstitial(tab);
2459 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 2459 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2460 AuthState::NONE); 2460 AuthState::NONE);
2461 2461
2462 ChromeSecurityStateModelClient* client = 2462 ChromeSecurityStateModel* model =
2463 ChromeSecurityStateModelClient::FromWebContents(tab); 2463 ChromeSecurityStateModel::FromWebContents(tab);
2464 ASSERT_TRUE(client); 2464 ASSERT_TRUE(model);
2465 security_state::SecurityStateModel::SecurityInfo security_info; 2465 security_state::SecurityStateModel::SecurityInfo security_info;
2466 client->GetSecurityInfo(&security_info); 2466 model->GetSecurityInfo(&security_info);
2467 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2467 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2468 security_info.mixed_content_status); 2468 security_info.mixed_content_status);
2469 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2469 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2470 security_info.content_with_cert_errors_status); 2470 security_info.content_with_cert_errors_status);
2471 2471
2472 // Navigate to safe page that has Worker loading unsafe content. 2472 // 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 2473 // Expect content to load but be marked as auth broken due to running insecure
2474 // content. 2474 // content.
2475 std::string page_with_unsafe_worker_path; 2475 std::string page_with_unsafe_worker_path;
2476 GetPageWithUnsafeWorkerPath(https_server_mismatched_, 2476 GetPageWithUnsafeWorkerPath(https_server_mismatched_,
2477 &page_with_unsafe_worker_path); 2477 &page_with_unsafe_worker_path);
2478 ui_test_utils::NavigateToURL( 2478 ui_test_utils::NavigateToURL(
2479 browser(), https_server_.GetURL(page_with_unsafe_worker_path)); 2479 browser(), https_server_.GetURL(page_with_unsafe_worker_path));
2480 CheckWorkerLoadResult(tab, true); // Worker loads insecure content 2480 CheckWorkerLoadResult(tab, true); // Worker loads insecure content
2481 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); 2481 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE);
2482 2482
2483 client->GetSecurityInfo(&security_info); 2483 model->GetSecurityInfo(&security_info);
2484 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2484 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2485 security_info.mixed_content_status); 2485 security_info.mixed_content_status);
2486 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_RAN, 2486 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_RAN,
2487 security_info.content_with_cert_errors_status); 2487 security_info.content_with_cert_errors_status);
2488 } 2488 }
2489 2489
2490 // Visits a page with unsafe content and makes sure that if a user exception to 2490 // 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. 2491 // the certificate error is present, the image is loaded and script executes.
2492 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) { 2492 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) {
2493 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2493 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2494 ASSERT_NO_FATAL_FAILURE(SetUpUnsafeContentsWithUserException( 2494 ASSERT_NO_FATAL_FAILURE(SetUpUnsafeContentsWithUserException(
2495 "/ssl/page_with_unsafe_contents.html")); 2495 "/ssl/page_with_unsafe_contents.html"));
2496 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE); 2496 CheckAuthenticationBrokenState(tab, CertError::NONE, AuthState::NONE);
2497 2497
2498 ChromeSecurityStateModelClient* client = 2498 ChromeSecurityStateModel* model =
2499 ChromeSecurityStateModelClient::FromWebContents(tab); 2499 ChromeSecurityStateModel::FromWebContents(tab);
2500 ASSERT_TRUE(client); 2500 ASSERT_TRUE(model);
2501 security_state::SecurityStateModel::SecurityInfo security_info; 2501 security_state::SecurityStateModel::SecurityInfo security_info;
2502 client->GetSecurityInfo(&security_info); 2502 model->GetSecurityInfo(&security_info);
2503 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2503 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2504 security_info.mixed_content_status); 2504 security_info.mixed_content_status);
2505 EXPECT_EQ( 2505 EXPECT_EQ(
2506 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, 2506 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN,
2507 security_info.content_with_cert_errors_status); 2507 security_info.content_with_cert_errors_status);
2508 2508
2509 int img_width; 2509 int img_width;
2510 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( 2510 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
2511 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); 2511 tab, "window.domAutomationController.send(ImageWidth());", &img_width));
2512 // In order to check that the image was loaded, we check its width. 2512 // In order to check that the image was loaded, we check its width.
(...skipping 14 matching lines...) Expand all
2527 https_server_mismatched_.host_port_pair(), &replacement_path); 2527 https_server_mismatched_.host_port_pair(), &replacement_path);
2528 ui_test_utils::NavigateToURL( 2528 ui_test_utils::NavigateToURL(
2529 browser(), https_server_mismatched_.GetURL(replacement_path)); 2529 browser(), https_server_mismatched_.GetURL(replacement_path));
2530 js_result = false; 2530 js_result = false;
2531 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 2531 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
2532 tab, "window.domAutomationController.send(IsFooSet());", &js_result)); 2532 tab, "window.domAutomationController.send(IsFooSet());", &js_result));
2533 EXPECT_TRUE(js_result); 2533 EXPECT_TRUE(js_result);
2534 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, 2534 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2535 AuthState::NONE); 2535 AuthState::NONE);
2536 2536
2537 client->GetSecurityInfo(&security_info); 2537 model->GetSecurityInfo(&security_info);
2538 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2538 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2539 security_info.mixed_content_status); 2539 security_info.mixed_content_status);
2540 EXPECT_EQ( 2540 EXPECT_EQ(
2541 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, 2541 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN,
2542 security_info.content_with_cert_errors_status); 2542 security_info.content_with_cert_errors_status);
2543 } 2543 }
2544 2544
2545 // Like the test above, but only displaying inactive content (an image). 2545 // Like the test above, but only displaying inactive content (an image).
2546 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) { 2546 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) {
2547 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2547 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2548 ASSERT_NO_FATAL_FAILURE( 2548 ASSERT_NO_FATAL_FAILURE(
2549 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html")); 2549 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html"));
2550 2550
2551 ChromeSecurityStateModelClient* client = 2551 ChromeSecurityStateModel* model =
2552 ChromeSecurityStateModelClient::FromWebContents(tab); 2552 ChromeSecurityStateModel::FromWebContents(tab);
2553 ASSERT_TRUE(client); 2553 ASSERT_TRUE(model);
2554 security_state::SecurityStateModel::SecurityInfo security_info; 2554 security_state::SecurityStateModel::SecurityInfo security_info;
2555 client->GetSecurityInfo(&security_info); 2555 model->GetSecurityInfo(&security_info);
2556 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, 2556 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE,
2557 security_info.mixed_content_status); 2557 security_info.mixed_content_status);
2558 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED, 2558 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED,
2559 security_info.content_with_cert_errors_status); 2559 security_info.content_with_cert_errors_status);
2560 EXPECT_EQ(security_state::SecurityStateModel::NONE, 2560 EXPECT_EQ(security_state::SecurityStateModel::NONE,
2561 security_info.security_level); 2561 security_info.security_level);
2562 EXPECT_EQ(0u, security_info.cert_status); 2562 EXPECT_EQ(0u, security_info.cert_status);
2563 2563
2564 int img_width; 2564 int img_width;
2565 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( 2565 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
3410 3410
3411 // Visit a page over https that contains a frame with a redirect. 3411 // Visit a page over https that contains a frame with a redirect.
3412 3412
3413 // XMLHttpRequest insecure content in synchronous mode. 3413 // XMLHttpRequest insecure content in synchronous mode.
3414 3414
3415 // XMLHttpRequest insecure content in asynchronous mode. 3415 // XMLHttpRequest insecure content in asynchronous mode.
3416 3416
3417 // XMLHttpRequest over bad ssl in synchronous mode. 3417 // XMLHttpRequest over bad ssl in synchronous mode.
3418 3418
3419 // XMLHttpRequest over OK ssl in synchronous mode. 3419 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698