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/security_state_tab_helper.h" | 5 #include "chrome/browser/ssl/security_state_tab_helper.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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 void SetUpOnMainThread() override { | 321 void SetUpOnMainThread() override { |
322 ASSERT_TRUE(embedded_test_server()->Start()); | 322 ASSERT_TRUE(embedded_test_server()->Start()); |
323 ASSERT_TRUE(https_server_.Start()); | 323 ASSERT_TRUE(https_server_.Start()); |
324 host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); | 324 host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); |
325 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 325 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
326 } | 326 } |
327 | 327 |
328 void SetUpCommandLine(base::CommandLine* command_line) override { | 328 void SetUpCommandLine(base::CommandLine* command_line) override { |
329 SecurityStateTabHelperTest::SetUpCommandLine(command_line); | 329 SecurityStateTabHelperTest::SetUpCommandLine(command_line); |
330 if (GetParam()) { | 330 command_line->AppendSwitchASCII( |
331 command_line->AppendSwitchASCII( | 331 security_state::switches::kMarkHttpAs, |
332 security_state::switches::kMarkHttpAs, | 332 security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); |
333 security_state::switches:: | |
334 kMarkHttpWithPasswordsOrCcWithChipAndFormWarning); | |
335 } else { | |
336 command_line->AppendSwitchASCII( | |
337 security_state::switches::kMarkHttpAs, | |
338 security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); | |
339 } | |
340 } | 333 } |
341 | 334 |
342 private: | 335 private: |
343 DISALLOW_COPY_AND_ASSIGN(SecurityStateTabHelperTestWithPasswordCcSwitch); | 336 DISALLOW_COPY_AND_ASSIGN(SecurityStateTabHelperTestWithPasswordCcSwitch); |
344 }; | 337 }; |
345 | 338 |
346 class DidChangeVisibleSecurityStateTest : public InProcessBrowserTest { | 339 class DidChangeVisibleSecurityStateTest : public InProcessBrowserTest { |
347 public: | 340 public: |
348 DidChangeVisibleSecurityStateTest() | 341 DidChangeVisibleSecurityStateTest() |
349 : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { | 342 : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void InjectScript(content::WebContents* contents) { | 892 void InjectScript(content::WebContents* contents) { |
900 bool js_result = false; | 893 bool js_result = false; |
901 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 894 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
902 contents, "window.domAutomationController.send(true);", &js_result)); | 895 contents, "window.domAutomationController.send(true);", &js_result)); |
903 EXPECT_TRUE(js_result); | 896 EXPECT_TRUE(js_result); |
904 } | 897 } |
905 | 898 |
906 // Tests that when a visible password field is detected on an HTTP page | 899 // Tests that when a visible password field is detected on an HTTP page |
907 // load, and when the command-line flag is set, the security level is | 900 // load, and when the command-line flag is set, the security level is |
908 // downgraded to HTTP_SHOW_WARNING. | 901 // downgraded to HTTP_SHOW_WARNING. |
909 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 902 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
910 PasswordSecurityLevelDowngraded) { | 903 PasswordSecurityLevelDowngraded) { |
911 content::WebContents* contents = | 904 content::WebContents* contents = |
912 browser()->tab_strip_model()->GetActiveWebContents(); | 905 browser()->tab_strip_model()->GetActiveWebContents(); |
913 ASSERT_TRUE(contents); | 906 ASSERT_TRUE(contents); |
914 | 907 |
915 SecurityStateTabHelper* helper = | 908 SecurityStateTabHelper* helper = |
916 SecurityStateTabHelper::FromWebContents(contents); | 909 SecurityStateTabHelper::FromWebContents(contents); |
917 ASSERT_TRUE(helper); | 910 ASSERT_TRUE(helper); |
918 | 911 |
919 ui_test_utils::NavigateToURL( | 912 ui_test_utils::NavigateToURL( |
920 browser(), GetURLWithNonLocalHostname(embedded_test_server(), | 913 browser(), GetURLWithNonLocalHostname(embedded_test_server(), |
921 "/password/simple_password.html")); | 914 "/password/simple_password.html")); |
922 InjectScript(contents); | 915 InjectScript(contents); |
923 security_state::SecurityInfo security_info; | 916 security_state::SecurityInfo security_info; |
924 helper->GetSecurityInfo(&security_info); | 917 helper->GetSecurityInfo(&security_info); |
925 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); | 918 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); |
926 | 919 |
927 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 920 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
928 ASSERT_TRUE(entry); | 921 ASSERT_TRUE(entry); |
929 EXPECT_TRUE(entry->GetSSL().content_status & | 922 EXPECT_TRUE(entry->GetSSL().content_status & |
930 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 923 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
931 } | 924 } |
932 | 925 |
933 // Tests that when an invisible password field is present on an HTTP page | 926 // Tests that when an invisible password field is present on an HTTP page |
934 // load, and when the command-line flag is set, the security level is | 927 // load, and when the command-line flag is set, the security level is |
935 // *not* downgraded to HTTP_SHOW_WARNING. | 928 // *not* downgraded to HTTP_SHOW_WARNING. |
936 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 929 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
937 PasswordSecurityLevelNotDowngradedForInvisibleInput) { | 930 PasswordSecurityLevelNotDowngradedForInvisibleInput) { |
938 content::WebContents* contents = | 931 content::WebContents* contents = |
939 browser()->tab_strip_model()->GetActiveWebContents(); | 932 browser()->tab_strip_model()->GetActiveWebContents(); |
940 ASSERT_TRUE(contents); | 933 ASSERT_TRUE(contents); |
941 | 934 |
942 SecurityStateTabHelper* helper = | 935 SecurityStateTabHelper* helper = |
943 SecurityStateTabHelper::FromWebContents(contents); | 936 SecurityStateTabHelper::FromWebContents(contents); |
944 ASSERT_TRUE(helper); | 937 ASSERT_TRUE(helper); |
945 | 938 |
946 ui_test_utils::NavigateToURL( | 939 ui_test_utils::NavigateToURL( |
947 browser(), | 940 browser(), |
948 GetURLWithNonLocalHostname(embedded_test_server(), | 941 GetURLWithNonLocalHostname(embedded_test_server(), |
949 "/password/invisible_password.html")); | 942 "/password/invisible_password.html")); |
950 InjectScript(contents); | 943 InjectScript(contents); |
951 security_state::SecurityInfo security_info; | 944 security_state::SecurityInfo security_info; |
952 helper->GetSecurityInfo(&security_info); | 945 helper->GetSecurityInfo(&security_info); |
953 EXPECT_EQ(security_state::NONE, security_info.security_level); | 946 EXPECT_EQ(security_state::NONE, security_info.security_level); |
954 | 947 |
955 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 948 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
956 ASSERT_TRUE(entry); | 949 ASSERT_TRUE(entry); |
957 EXPECT_FALSE(entry->GetSSL().content_status & | 950 EXPECT_FALSE(entry->GetSSL().content_status & |
958 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 951 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
959 } | 952 } |
960 | 953 |
961 // Tests that when a visible password field is detected inside an iframe | 954 // Tests that when a visible password field is detected inside an iframe |
962 // on an HTTP page load, and when the command-line flag is set, the | 955 // on an HTTP page load, and when the command-line flag is set, the |
963 // security level is downgraded to HTTP_SHOW_WARNING. | 956 // security level is downgraded to HTTP_SHOW_WARNING. |
964 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 957 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
965 PasswordSecurityLevelDowngradedFromIframe) { | 958 PasswordSecurityLevelDowngradedFromIframe) { |
966 content::WebContents* contents = | 959 content::WebContents* contents = |
967 browser()->tab_strip_model()->GetActiveWebContents(); | 960 browser()->tab_strip_model()->GetActiveWebContents(); |
968 ASSERT_TRUE(contents); | 961 ASSERT_TRUE(contents); |
969 | 962 |
970 SecurityStateTabHelper* helper = | 963 SecurityStateTabHelper* helper = |
971 SecurityStateTabHelper::FromWebContents(contents); | 964 SecurityStateTabHelper::FromWebContents(contents); |
972 ASSERT_TRUE(helper); | 965 ASSERT_TRUE(helper); |
973 | 966 |
974 ui_test_utils::NavigateToURL( | 967 ui_test_utils::NavigateToURL( |
(...skipping 16 matching lines...) Expand all Loading... |
991 // security level is downgraded to HTTP_SHOW_WARNING, even if the iframe | 984 // security level is downgraded to HTTP_SHOW_WARNING, even if the iframe |
992 // itself was loaded over HTTPS. | 985 // itself was loaded over HTTPS. |
993 #if defined(OS_LINUX) | 986 #if defined(OS_LINUX) |
994 // Flaky on Linux. See https://crbug.com/662485. | 987 // Flaky on Linux. See https://crbug.com/662485. |
995 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ | 988 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ |
996 DISABLED_PasswordSecurityLevelDowngradedFromHttpsIframe | 989 DISABLED_PasswordSecurityLevelDowngradedFromHttpsIframe |
997 #else | 990 #else |
998 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ | 991 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ |
999 PasswordSecurityLevelDowngradedFromHttpsIframe | 992 PasswordSecurityLevelDowngradedFromHttpsIframe |
1000 #endif | 993 #endif |
1001 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 994 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
1002 MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) { | 995 MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) { |
1003 content::WebContents* contents = | 996 content::WebContents* contents = |
1004 browser()->tab_strip_model()->GetActiveWebContents(); | 997 browser()->tab_strip_model()->GetActiveWebContents(); |
1005 ASSERT_TRUE(contents); | 998 ASSERT_TRUE(contents); |
1006 | 999 |
1007 SecurityStateTabHelper* helper = | 1000 SecurityStateTabHelper* helper = |
1008 SecurityStateTabHelper::FromWebContents(contents); | 1001 SecurityStateTabHelper::FromWebContents(contents); |
1009 ASSERT_TRUE(helper); | 1002 ASSERT_TRUE(helper); |
1010 | 1003 |
1011 // Navigate to an HTTP URL, which loads an iframe using the host and port of | 1004 // Navigate to an HTTP URL, which loads an iframe using the host and port of |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 // The appropriate SSLStatus flags should be set, however. | 1050 // The appropriate SSLStatus flags should be set, however. |
1058 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); | 1051 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); |
1059 ASSERT_TRUE(entry); | 1052 ASSERT_TRUE(entry); |
1060 EXPECT_TRUE(entry->GetSSL().content_status & | 1053 EXPECT_TRUE(entry->GetSSL().content_status & |
1061 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); | 1054 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); |
1062 } | 1055 } |
1063 | 1056 |
1064 // Tests that when a visible password field is detected on an HTTPS page | 1057 // Tests that when a visible password field is detected on an HTTPS page |
1065 // load, and when the command-line flag is set, the security level is | 1058 // load, and when the command-line flag is set, the security level is |
1066 // *not* downgraded to HTTP_SHOW_WARNING. | 1059 // *not* downgraded to HTTP_SHOW_WARNING. |
1067 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 1060 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
1068 PasswordSecurityLevelNotDowngradedOnHttps) { | 1061 PasswordSecurityLevelNotDowngradedOnHttps) { |
1069 content::WebContents* contents = | 1062 content::WebContents* contents = |
1070 browser()->tab_strip_model()->GetActiveWebContents(); | 1063 browser()->tab_strip_model()->GetActiveWebContents(); |
1071 ASSERT_TRUE(contents); | 1064 ASSERT_TRUE(contents); |
1072 | 1065 |
1073 SecurityStateTabHelper* helper = | 1066 SecurityStateTabHelper* helper = |
1074 SecurityStateTabHelper::FromWebContents(contents); | 1067 SecurityStateTabHelper::FromWebContents(contents); |
1075 ASSERT_TRUE(helper); | 1068 ASSERT_TRUE(helper); |
1076 | 1069 |
1077 GURL url = GetURLWithNonLocalHostname(&https_server_, | 1070 GURL url = GetURLWithNonLocalHostname(&https_server_, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 ConsoleWebContentsDelegate* delegate) { | 1146 ConsoleWebContentsDelegate* delegate) { |
1154 const std::vector<base::string16>& messages = delegate->console_messages(); | 1147 const std::vector<base::string16>& messages = delegate->console_messages(); |
1155 ASSERT_EQ(1u, messages.size()); | 1148 ASSERT_EQ(1u, messages.size()); |
1156 EXPECT_NE(base::string16::npos, | 1149 EXPECT_NE(base::string16::npos, |
1157 messages[0].find(base::ASCIIToUTF16("warning will be added"))); | 1150 messages[0].find(base::ASCIIToUTF16("warning will be added"))); |
1158 } | 1151 } |
1159 | 1152 |
1160 // Tests that console messages are printed upon a call to | 1153 // Tests that console messages are printed upon a call to |
1161 // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per | 1154 // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per |
1162 // main-frame navigation. | 1155 // main-frame navigation. |
1163 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 1156 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
1164 ConsoleMessage) { | 1157 ConsoleMessage) { |
1165 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( | 1158 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
1166 Browser::CreateParams(browser()->profile())); | 1159 Browser::CreateParams(browser()->profile())); |
1167 content::WebContents* original_contents = | 1160 content::WebContents* original_contents = |
1168 browser()->tab_strip_model()->GetActiveWebContents(); | 1161 browser()->tab_strip_model()->GetActiveWebContents(); |
1169 content::WebContents* contents = | 1162 content::WebContents* contents = |
1170 content::WebContents::Create(content::WebContents::CreateParams( | 1163 content::WebContents::Create(content::WebContents::CreateParams( |
1171 original_contents->GetBrowserContext())); | 1164 original_contents->GetBrowserContext())); |
1172 ASSERT_TRUE(contents); | 1165 ASSERT_TRUE(contents); |
1173 contents->SetDelegate(delegate); | 1166 contents->SetDelegate(delegate); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 | 1305 |
1313 helper->GetSecurityInfo(&security_info); | 1306 helper->GetSecurityInfo(&security_info); |
1314 EXPECT_EQ(security_state::NONE, security_info.security_level); | 1307 EXPECT_EQ(security_state::NONE, security_info.security_level); |
1315 EXPECT_TRUE(security_info.displayed_credit_card_field_on_http); | 1308 EXPECT_TRUE(security_info.displayed_credit_card_field_on_http); |
1316 | 1309 |
1317 ASSERT_NO_FATAL_FAILURE(CheckForOneFutureHttpWarningConsoleMessage(delegate)); | 1310 ASSERT_NO_FATAL_FAILURE(CheckForOneFutureHttpWarningConsoleMessage(delegate)); |
1318 } | 1311 } |
1319 | 1312 |
1320 // Tests that additional HTTP_SHOW_WARNING console messages are not | 1313 // Tests that additional HTTP_SHOW_WARNING console messages are not |
1321 // printed after subframe navigations. | 1314 // printed after subframe navigations. |
1322 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 1315 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
1323 ConsoleMessageNotPrintedForFrameNavigation) { | 1316 ConsoleMessageNotPrintedForFrameNavigation) { |
1324 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( | 1317 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
1325 Browser::CreateParams(browser()->profile())); | 1318 Browser::CreateParams(browser()->profile())); |
1326 content::WebContents* original_contents = | 1319 content::WebContents* original_contents = |
1327 browser()->tab_strip_model()->GetActiveWebContents(); | 1320 browser()->tab_strip_model()->GetActiveWebContents(); |
1328 content::WebContents* contents = | 1321 content::WebContents* contents = |
1329 content::WebContents::Create(content::WebContents::CreateParams( | 1322 content::WebContents::Create(content::WebContents::CreateParams( |
1330 original_contents->GetBrowserContext())); | 1323 original_contents->GetBrowserContext())); |
1331 ASSERT_TRUE(contents); | 1324 ASSERT_TRUE(contents); |
1332 contents->SetDelegate(delegate); | 1325 contents->SetDelegate(delegate); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 contents->OnPasswordInputShownOnHttp(); | 1386 contents->OnPasswordInputShownOnHttp(); |
1394 second_message.Run(); | 1387 second_message.Run(); |
1395 | 1388 |
1396 helper->GetSecurityInfo(&security_info); | 1389 helper->GetSecurityInfo(&security_info); |
1397 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); | 1390 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); |
1398 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); | 1391 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); |
1399 } | 1392 } |
1400 | 1393 |
1401 // Tests that additional HTTP_SHOW_WARNING console messages are not | 1394 // Tests that additional HTTP_SHOW_WARNING console messages are not |
1402 // printed after pushState navigations. | 1395 // printed after pushState navigations. |
1403 IN_PROC_BROWSER_TEST_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | 1396 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch, |
1404 ConsoleMessageNotPrintedForPushStateNavigation) { | 1397 ConsoleMessageNotPrintedForPushStateNavigation) { |
1405 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( | 1398 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
1406 Browser::CreateParams(browser()->profile())); | 1399 Browser::CreateParams(browser()->profile())); |
1407 content::WebContents* original_contents = | 1400 content::WebContents* original_contents = |
1408 browser()->tab_strip_model()->GetActiveWebContents(); | 1401 browser()->tab_strip_model()->GetActiveWebContents(); |
1409 content::WebContents* contents = | 1402 content::WebContents* contents = |
1410 content::WebContents::Create(content::WebContents::CreateParams( | 1403 content::WebContents::Create(content::WebContents::CreateParams( |
1411 original_contents->GetBrowserContext())); | 1404 original_contents->GetBrowserContext())); |
1412 ASSERT_TRUE(contents); | 1405 ASSERT_TRUE(contents); |
1413 contents->SetDelegate(delegate); | 1406 contents->SetDelegate(delegate); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 base::RunLoop second_message; | 1460 base::RunLoop second_message; |
1468 delegate->set_console_message_callback(second_message.QuitClosure()); | 1461 delegate->set_console_message_callback(second_message.QuitClosure()); |
1469 contents->OnPasswordInputShownOnHttp(); | 1462 contents->OnPasswordInputShownOnHttp(); |
1470 second_message.Run(); | 1463 second_message.Run(); |
1471 | 1464 |
1472 helper->GetSecurityInfo(&security_info); | 1465 helper->GetSecurityInfo(&security_info); |
1473 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); | 1466 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); |
1474 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); | 1467 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); |
1475 } | 1468 } |
1476 | 1469 |
1477 INSTANTIATE_TEST_CASE_P(SecurityStateTabHelperTestWithPasswordCcSwitch, | |
1478 SecurityStateTabHelperTestWithPasswordCcSwitch, | |
1479 // Here 'true' means that the omnibox warning + form | |
1480 // warning are enabled, and 'false' means just the | |
1481 // omnibox warning is enabled. | |
1482 testing::Bool()); | |
1483 | |
1484 // Tests that the security state for a WebContents is up to date when the | 1470 // Tests that the security state for a WebContents is up to date when the |
1485 // WebContents is inserted into a Browser's TabStripModel. | 1471 // WebContents is inserted into a Browser's TabStripModel. |
1486 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, AddedTab) { | 1472 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, AddedTab) { |
1487 ASSERT_TRUE(https_server_.Start()); | 1473 ASSERT_TRUE(https_server_.Start()); |
1488 SetUpMockCertVerifierForHttpsServer(0, net::OK); | 1474 SetUpMockCertVerifierForHttpsServer(0, net::OK); |
1489 | 1475 |
1490 content::WebContents* tab = | 1476 content::WebContents* tab = |
1491 browser()->tab_strip_model()->GetActiveWebContents(); | 1477 browser()->tab_strip_model()->GetActiveWebContents(); |
1492 ASSERT_TRUE(tab); | 1478 ASSERT_TRUE(tab); |
1493 | 1479 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 SecurityStateTabHelper* helper = | 2024 SecurityStateTabHelper* helper = |
2039 SecurityStateTabHelper::FromWebContents(web_contents); | 2025 SecurityStateTabHelper::FromWebContents(web_contents); |
2040 ASSERT_TRUE(helper); | 2026 ASSERT_TRUE(helper); |
2041 security_state::SecurityInfo security_info; | 2027 security_state::SecurityInfo security_info; |
2042 helper->GetSecurityInfo(&security_info); | 2028 helper->GetSecurityInfo(&security_info); |
2043 EXPECT_EQ(security_state::SECURE, security_info.security_level); | 2029 EXPECT_EQ(security_state::SECURE, security_info.security_level); |
2044 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); | 2030 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); |
2045 } | 2031 } |
2046 | 2032 |
2047 } // namespace | 2033 } // namespace |
OLD | NEW |