OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ssl/chrome_security_state_model_client.h" | 5 #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 CheckSecurityInfoForSecure( | 846 CheckSecurityInfoForSecure( |
847 browser()->tab_strip_model()->GetActiveWebContents(), | 847 browser()->tab_strip_model()->GetActiveWebContents(), |
848 SecurityStateModel::SECURE, SecurityStateModel::NO_DEPRECATED_SHA1, | 848 SecurityStateModel::SECURE, SecurityStateModel::NO_DEPRECATED_SHA1, |
849 SecurityStateModel::CONTENT_STATUS_NONE, false, | 849 SecurityStateModel::CONTENT_STATUS_NONE, false, |
850 false /* expect cert status error */); | 850 false /* expect cert status error */); |
851 | 851 |
852 // Navigate to a page that doesn't finish loading. Test that the | 852 // Navigate to a page that doesn't finish loading. Test that the |
853 // security state is neutral while the page is loading. | 853 // security state is neutral while the page is loading. |
854 browser()->OpenURL(content::OpenURLParams( | 854 browser()->OpenURL(content::OpenURLParams( |
855 embedded_test_server()->GetURL("/title1.html"), content::Referrer(), | 855 embedded_test_server()->GetURL("/title1.html"), content::Referrer(), |
856 CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); | 856 WindowOpenDisposition::CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); |
857 CheckSecurityInfoForNonSecure( | 857 CheckSecurityInfoForNonSecure( |
858 browser()->tab_strip_model()->GetActiveWebContents()); | 858 browser()->tab_strip_model()->GetActiveWebContents()); |
859 } | 859 } |
860 | 860 |
861 // Tests that the SecurityStateModel for a WebContents is up to date | 861 // Tests that the SecurityStateModel for a WebContents is up to date |
862 // when the WebContents is inserted into a Browser's TabStripModel. | 862 // when the WebContents is inserted into a Browser's TabStripModel. |
863 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { | 863 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { |
864 ASSERT_TRUE(https_server_.Start()); | 864 ASSERT_TRUE(https_server_.Start()); |
865 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 865 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
866 | 866 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); | 1079 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); |
1080 EXPECT_FALSE(observer.latest_explanations().pkp_bypassed); | 1080 EXPECT_FALSE(observer.latest_explanations().pkp_bypassed); |
1081 EXPECT_TRUE(observer.latest_explanations().info_explanations.empty()); | 1081 EXPECT_TRUE(observer.latest_explanations().info_explanations.empty()); |
1082 EXPECT_FALSE(observer.latest_explanations().displayed_mixed_content); | 1082 EXPECT_FALSE(observer.latest_explanations().displayed_mixed_content); |
1083 EXPECT_FALSE(observer.latest_explanations().ran_mixed_content); | 1083 EXPECT_FALSE(observer.latest_explanations().ran_mixed_content); |
1084 | 1084 |
1085 content::WindowedNotificationObserver back_nav_load_observer( | 1085 content::WindowedNotificationObserver back_nav_load_observer( |
1086 content::NOTIFICATION_LOAD_STOP, | 1086 content::NOTIFICATION_LOAD_STOP, |
1087 content::Source<content::NavigationController>( | 1087 content::Source<content::NavigationController>( |
1088 &web_contents->GetController())); | 1088 &web_contents->GetController())); |
1089 chrome::GoBack(browser(), CURRENT_TAB); | 1089 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
1090 back_nav_load_observer.Wait(); | 1090 back_nav_load_observer.Wait(); |
1091 | 1091 |
1092 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, | 1092 EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATED, |
1093 observer.latest_security_style()); | 1093 observer.latest_security_style()); |
1094 EXPECT_EQ(0u, | 1094 EXPECT_EQ(0u, |
1095 observer.latest_explanations().unauthenticated_explanations.size()); | 1095 observer.latest_explanations().unauthenticated_explanations.size()); |
1096 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); | 1096 EXPECT_EQ(0u, observer.latest_explanations().broken_explanations.size()); |
1097 CheckSecureExplanations(observer.latest_explanations().secure_explanations, | 1097 CheckSecureExplanations(observer.latest_explanations().secure_explanations, |
1098 VALID_CERTIFICATE, browser()); | 1098 VALID_CERTIFICATE, browser()); |
1099 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); | 1099 EXPECT_TRUE(observer.latest_explanations().scheme_is_cryptographic); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 ChromeSecurityStateModelClient* model_client = | 1395 ChromeSecurityStateModelClient* model_client = |
1396 ChromeSecurityStateModelClient::FromWebContents(web_contents); | 1396 ChromeSecurityStateModelClient::FromWebContents(web_contents); |
1397 ASSERT_TRUE(model_client); | 1397 ASSERT_TRUE(model_client); |
1398 const SecurityStateModel::SecurityInfo& security_info = | 1398 const SecurityStateModel::SecurityInfo& security_info = |
1399 model_client->GetSecurityInfo(); | 1399 model_client->GetSecurityInfo(); |
1400 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); | 1400 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); |
1401 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); | 1401 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
1402 } | 1402 } |
1403 | 1403 |
1404 } // namespace | 1404 } // namespace |
OLD | NEW |