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

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

Issue 2472943004: HTTP Bad: Add a switch for showing both verbose state and form warning (Closed)
Patch Set: add a comment 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/security_state/security_state_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 }; 304 };
305 305
306 GURL GetURLWithNonLocalHostname(net::EmbeddedTestServer* server, 306 GURL GetURLWithNonLocalHostname(net::EmbeddedTestServer* server,
307 const std::string& path) { 307 const std::string& path) {
308 GURL::Replacements replace_host; 308 GURL::Replacements replace_host;
309 replace_host.SetHostStr("example.test"); 309 replace_host.SetHostStr("example.test");
310 return server->GetURL(path).ReplaceComponents(replace_host); 310 return server->GetURL(path).ReplaceComponents(replace_host);
311 } 311 }
312 312
313 class ChromeSecurityStateModelClientTestWithPasswordCcSwitch 313 class ChromeSecurityStateModelClientTestWithPasswordCcSwitch
314 : public ChromeSecurityStateModelClientTest { 314 : public ChromeSecurityStateModelClientTest,
315 public testing::WithParamInterface<bool> {
315 public: 316 public:
316 ChromeSecurityStateModelClientTestWithPasswordCcSwitch() 317 ChromeSecurityStateModelClientTestWithPasswordCcSwitch()
317 : ChromeSecurityStateModelClientTest() {} 318 : ChromeSecurityStateModelClientTest() {}
318 319
319 void SetUpOnMainThread() override { 320 void SetUpOnMainThread() override {
320 ASSERT_TRUE(embedded_test_server()->Start()); 321 ASSERT_TRUE(embedded_test_server()->Start());
321 ASSERT_TRUE(https_server_.Start()); 322 ASSERT_TRUE(https_server_.Start());
322 host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); 323 host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host());
323 SetUpMockCertVerifierForHttpsServer(0, net::OK); 324 SetUpMockCertVerifierForHttpsServer(0, net::OK);
324 } 325 }
325 326
326 void SetUpCommandLine(base::CommandLine* command_line) override { 327 void SetUpCommandLine(base::CommandLine* command_line) override {
327 ChromeSecurityStateModelClientTest::SetUpCommandLine(command_line); 328 ChromeSecurityStateModelClientTest::SetUpCommandLine(command_line);
328 command_line->AppendSwitchASCII( 329 if (GetParam()) {
329 security_state::switches::kMarkHttpAs, 330 command_line->AppendSwitchASCII(
330 security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); 331 security_state::switches::kMarkHttpAs,
332 security_state::switches::
333 kMarkHttpWithPasswordsOrCcWithChipAndFormWarning);
334 } else {
335 command_line->AppendSwitchASCII(
336 security_state::switches::kMarkHttpAs,
337 security_state::switches::kMarkHttpWithPasswordsOrCcWithChip);
338 }
331 } 339 }
332 340
333 private: 341 private:
334 DISALLOW_COPY_AND_ASSIGN( 342 DISALLOW_COPY_AND_ASSIGN(
335 ChromeSecurityStateModelClientTestWithPasswordCcSwitch); 343 ChromeSecurityStateModelClientTestWithPasswordCcSwitch);
336 }; 344 };
337 345
338 class SecurityStyleChangedTest : public InProcessBrowserTest { 346 class SecurityStyleChangedTest : public InProcessBrowserTest {
339 public: 347 public:
340 SecurityStyleChangedTest() 348 SecurityStyleChangedTest()
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 &visible_security_state_sensitive_inputs); 941 &visible_security_state_sensitive_inputs);
934 EXPECT_TRUE( 942 EXPECT_TRUE(
935 visible_security_state_sensitive_inputs.displayed_password_field_on_http); 943 visible_security_state_sensitive_inputs.displayed_password_field_on_http);
936 EXPECT_TRUE(visible_security_state_sensitive_inputs 944 EXPECT_TRUE(visible_security_state_sensitive_inputs
937 .displayed_credit_card_field_on_http); 945 .displayed_credit_card_field_on_http);
938 } 946 }
939 947
940 // Tests that when a visible password field is detected on an HTTP page 948 // Tests that when a visible password field is detected on an HTTP page
941 // load, and when the command-line flag is set, the security level is 949 // load, and when the command-line flag is set, the security level is
942 // downgraded to HTTP_SHOW_WARNING. 950 // downgraded to HTTP_SHOW_WARNING.
943 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 951 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
944 PasswordSecurityLevelDowngraded) { 952 PasswordSecurityLevelDowngraded) {
945 content::WebContents* contents = 953 content::WebContents* contents =
946 browser()->tab_strip_model()->GetActiveWebContents(); 954 browser()->tab_strip_model()->GetActiveWebContents();
947 ASSERT_TRUE(contents); 955 ASSERT_TRUE(contents);
948 956
949 ChromeSecurityStateModelClient* model_client = 957 ChromeSecurityStateModelClient* model_client =
950 ChromeSecurityStateModelClient::FromWebContents(contents); 958 ChromeSecurityStateModelClient::FromWebContents(contents);
951 ASSERT_TRUE(model_client); 959 ASSERT_TRUE(model_client);
952 960
953 ui_test_utils::NavigateToURL( 961 ui_test_utils::NavigateToURL(
954 browser(), GetURLWithNonLocalHostname(embedded_test_server(), 962 browser(), GetURLWithNonLocalHostname(embedded_test_server(),
955 "/password/simple_password.html")); 963 "/password/simple_password.html"));
956 security_state::SecurityStateModel::SecurityInfo security_info; 964 security_state::SecurityStateModel::SecurityInfo security_info;
957 model_client->GetSecurityInfo(&security_info); 965 model_client->GetSecurityInfo(&security_info);
958 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, 966 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING,
959 security_info.security_level); 967 security_info.security_level);
960 968
961 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); 969 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
962 ASSERT_TRUE(entry); 970 ASSERT_TRUE(entry);
963 EXPECT_TRUE(entry->GetSSL().content_status & 971 EXPECT_TRUE(entry->GetSSL().content_status &
964 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 972 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
965 } 973 }
966 974
967 // Tests that when an invisible password field is present on an HTTP page 975 // Tests that when an invisible password field is present on an HTTP page
968 // load, and when the command-line flag is set, the security level is 976 // load, and when the command-line flag is set, the security level is
969 // *not* downgraded to HTTP_SHOW_WARNING. 977 // *not* downgraded to HTTP_SHOW_WARNING.
970 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 978 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
971 PasswordSecurityLevelNotDowngradedForInvisibleInput) { 979 PasswordSecurityLevelNotDowngradedForInvisibleInput) {
972 content::WebContents* contents = 980 content::WebContents* contents =
973 browser()->tab_strip_model()->GetActiveWebContents(); 981 browser()->tab_strip_model()->GetActiveWebContents();
974 ASSERT_TRUE(contents); 982 ASSERT_TRUE(contents);
975 983
976 ChromeSecurityStateModelClient* model_client = 984 ChromeSecurityStateModelClient* model_client =
977 ChromeSecurityStateModelClient::FromWebContents(contents); 985 ChromeSecurityStateModelClient::FromWebContents(contents);
978 ASSERT_TRUE(model_client); 986 ASSERT_TRUE(model_client);
979 987
980 ui_test_utils::NavigateToURL( 988 ui_test_utils::NavigateToURL(
981 browser(), 989 browser(),
982 GetURLWithNonLocalHostname(embedded_test_server(), 990 GetURLWithNonLocalHostname(embedded_test_server(),
983 "/password/invisible_password.html")); 991 "/password/invisible_password.html"));
984 security_state::SecurityStateModel::SecurityInfo security_info; 992 security_state::SecurityStateModel::SecurityInfo security_info;
985 model_client->GetSecurityInfo(&security_info); 993 model_client->GetSecurityInfo(&security_info);
986 EXPECT_EQ(security_state::SecurityStateModel::NONE, 994 EXPECT_EQ(security_state::SecurityStateModel::NONE,
987 security_info.security_level); 995 security_info.security_level);
988 996
989 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); 997 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
990 ASSERT_TRUE(entry); 998 ASSERT_TRUE(entry);
991 EXPECT_FALSE(entry->GetSSL().content_status & 999 EXPECT_FALSE(entry->GetSSL().content_status &
992 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 1000 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
993 } 1001 }
994 1002
995 // Tests that when a visible password field is detected inside an iframe 1003 // Tests that when a visible password field is detected inside an iframe
996 // on an HTTP page load, and when the command-line flag is set, the 1004 // on an HTTP page load, and when the command-line flag is set, the
997 // security level is downgraded to HTTP_SHOW_WARNING. 1005 // security level is downgraded to HTTP_SHOW_WARNING.
998 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1006 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
999 PasswordSecurityLevelDowngradedFromIframe) { 1007 PasswordSecurityLevelDowngradedFromIframe) {
1000 content::WebContents* contents = 1008 content::WebContents* contents =
1001 browser()->tab_strip_model()->GetActiveWebContents(); 1009 browser()->tab_strip_model()->GetActiveWebContents();
1002 ASSERT_TRUE(contents); 1010 ASSERT_TRUE(contents);
1003 1011
1004 ChromeSecurityStateModelClient* model_client = 1012 ChromeSecurityStateModelClient* model_client =
1005 ChromeSecurityStateModelClient::FromWebContents(contents); 1013 ChromeSecurityStateModelClient::FromWebContents(contents);
1006 ASSERT_TRUE(model_client); 1014 ASSERT_TRUE(model_client);
1007 1015
1008 ui_test_utils::NavigateToURL( 1016 ui_test_utils::NavigateToURL(
(...skipping 16 matching lines...) Expand all
1025 // security level is downgraded to HTTP_SHOW_WARNING, even if the iframe 1033 // security level is downgraded to HTTP_SHOW_WARNING, even if the iframe
1026 // itself was loaded over HTTPS. 1034 // itself was loaded over HTTPS.
1027 #if defined(OS_LINUX) 1035 #if defined(OS_LINUX)
1028 // Flaky on Linux. See https://crbug.com/662485. 1036 // Flaky on Linux. See https://crbug.com/662485.
1029 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ 1037 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \
1030 DISABLED_PasswordSecurityLevelDowngradedFromHttpsIframe 1038 DISABLED_PasswordSecurityLevelDowngradedFromHttpsIframe
1031 #else 1039 #else
1032 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \ 1040 #define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \
1033 PasswordSecurityLevelDowngradedFromHttpsIframe 1041 PasswordSecurityLevelDowngradedFromHttpsIframe
1034 #endif 1042 #endif
1035 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1043 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1036 MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) { 1044 MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) {
1037 content::WebContents* contents = 1045 content::WebContents* contents =
1038 browser()->tab_strip_model()->GetActiveWebContents(); 1046 browser()->tab_strip_model()->GetActiveWebContents();
1039 ASSERT_TRUE(contents); 1047 ASSERT_TRUE(contents);
1040 1048
1041 ChromeSecurityStateModelClient* model_client = 1049 ChromeSecurityStateModelClient* model_client =
1042 ChromeSecurityStateModelClient::FromWebContents(contents); 1050 ChromeSecurityStateModelClient::FromWebContents(contents);
1043 ASSERT_TRUE(model_client); 1051 ASSERT_TRUE(model_client);
1044 1052
1045 // Navigate to an HTTP URL, which loads an iframe using the host and port of 1053 // 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
1091 // The appropriate SSLStatus flags should be set, however. 1099 // The appropriate SSLStatus flags should be set, however.
1092 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); 1100 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
1093 ASSERT_TRUE(entry); 1101 ASSERT_TRUE(entry);
1094 EXPECT_TRUE(entry->GetSSL().content_status & 1102 EXPECT_TRUE(entry->GetSSL().content_status &
1095 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP); 1103 content::SSLStatus::DISPLAYED_PASSWORD_FIELD_ON_HTTP);
1096 } 1104 }
1097 1105
1098 // Tests that when a visible password field is detected on an HTTPS page 1106 // Tests that when a visible password field is detected on an HTTPS page
1099 // load, and when the command-line flag is set, the security level is 1107 // load, and when the command-line flag is set, the security level is
1100 // *not* downgraded to HTTP_SHOW_WARNING. 1108 // *not* downgraded to HTTP_SHOW_WARNING.
1101 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1109 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1102 PasswordSecurityLevelNotDowngradedOnHttps) { 1110 PasswordSecurityLevelNotDowngradedOnHttps) {
1103 content::WebContents* contents = 1111 content::WebContents* contents =
1104 browser()->tab_strip_model()->GetActiveWebContents(); 1112 browser()->tab_strip_model()->GetActiveWebContents();
1105 ASSERT_TRUE(contents); 1113 ASSERT_TRUE(contents);
1106 1114
1107 ChromeSecurityStateModelClient* model_client = 1115 ChromeSecurityStateModelClient* model_client =
1108 ChromeSecurityStateModelClient::FromWebContents(contents); 1116 ChromeSecurityStateModelClient::FromWebContents(contents);
1109 ASSERT_TRUE(model_client); 1117 ASSERT_TRUE(model_client);
1110 1118
1111 GURL url = GetURLWithNonLocalHostname(&https_server_, 1119 GURL url = GetURLWithNonLocalHostname(&https_server_,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 ConsoleWebContentsDelegate* delegate) { 1195 ConsoleWebContentsDelegate* delegate) {
1188 const std::vector<base::string16>& messages = delegate->console_messages(); 1196 const std::vector<base::string16>& messages = delegate->console_messages();
1189 ASSERT_EQ(1u, messages.size()); 1197 ASSERT_EQ(1u, messages.size());
1190 EXPECT_NE(base::string16::npos, 1198 EXPECT_NE(base::string16::npos,
1191 messages[0].find(base::ASCIIToUTF16("warning will be added"))); 1199 messages[0].find(base::ASCIIToUTF16("warning will be added")));
1192 } 1200 }
1193 1201
1194 // Tests that console messages are printed upon a call to 1202 // Tests that console messages are printed upon a call to
1195 // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per 1203 // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per
1196 // main-frame navigation. 1204 // main-frame navigation.
1197 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1205 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1198 ConsoleMessage) { 1206 ConsoleMessage) {
1199 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( 1207 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
1200 Browser::CreateParams(browser()->profile())); 1208 Browser::CreateParams(browser()->profile()));
1201 content::WebContents* original_contents = 1209 content::WebContents* original_contents =
1202 browser()->tab_strip_model()->GetActiveWebContents(); 1210 browser()->tab_strip_model()->GetActiveWebContents();
1203 content::WebContents* contents = 1211 content::WebContents* contents =
1204 content::WebContents::Create(content::WebContents::CreateParams( 1212 content::WebContents::Create(content::WebContents::CreateParams(
1205 original_contents->GetBrowserContext())); 1213 original_contents->GetBrowserContext()));
1206 ASSERT_TRUE(contents); 1214 ASSERT_TRUE(contents);
1207 contents->SetDelegate(delegate); 1215 contents->SetDelegate(delegate);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 client->GetSecurityInfo(&security_info); 1339 client->GetSecurityInfo(&security_info);
1332 EXPECT_EQ(security_state::SecurityStateModel::NONE, 1340 EXPECT_EQ(security_state::SecurityStateModel::NONE,
1333 security_info.security_level); 1341 security_info.security_level);
1334 EXPECT_TRUE(security_info.displayed_private_user_data_input_on_http); 1342 EXPECT_TRUE(security_info.displayed_private_user_data_input_on_http);
1335 1343
1336 ASSERT_NO_FATAL_FAILURE(CheckForOneFutureHttpWarningConsoleMessage(delegate)); 1344 ASSERT_NO_FATAL_FAILURE(CheckForOneFutureHttpWarningConsoleMessage(delegate));
1337 } 1345 }
1338 1346
1339 // Tests that additional HTTP_SHOW_WARNING console messages are not 1347 // Tests that additional HTTP_SHOW_WARNING console messages are not
1340 // printed after subframe navigations. 1348 // printed after subframe navigations.
1341 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1349 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1342 ConsoleMessageNotPrintedForFrameNavigation) { 1350 ConsoleMessageNotPrintedForFrameNavigation) {
1343 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( 1351 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
1344 Browser::CreateParams(browser()->profile())); 1352 Browser::CreateParams(browser()->profile()));
1345 content::WebContents* original_contents = 1353 content::WebContents* original_contents =
1346 browser()->tab_strip_model()->GetActiveWebContents(); 1354 browser()->tab_strip_model()->GetActiveWebContents();
1347 content::WebContents* contents = 1355 content::WebContents* contents =
1348 content::WebContents::Create(content::WebContents::CreateParams( 1356 content::WebContents::Create(content::WebContents::CreateParams(
1349 original_contents->GetBrowserContext())); 1357 original_contents->GetBrowserContext()));
1350 ASSERT_TRUE(contents); 1358 ASSERT_TRUE(contents);
1351 contents->SetDelegate(delegate); 1359 contents->SetDelegate(delegate);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 second_message.Run(); 1423 second_message.Run();
1416 1424
1417 client->GetSecurityInfo(&security_info); 1425 client->GetSecurityInfo(&security_info);
1418 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, 1426 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING,
1419 security_info.security_level); 1427 security_info.security_level);
1420 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); 1428 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate));
1421 } 1429 }
1422 1430
1423 // Tests that additional HTTP_SHOW_WARNING console messages are not 1431 // Tests that additional HTTP_SHOW_WARNING console messages are not
1424 // printed after pushState navigations. 1432 // printed after pushState navigations.
1425 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, 1433 IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1426 ConsoleMessageNotPrintedForPushStateNavigation) { 1434 ConsoleMessageNotPrintedForPushStateNavigation) {
1427 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( 1435 ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
1428 Browser::CreateParams(browser()->profile())); 1436 Browser::CreateParams(browser()->profile()));
1429 content::WebContents* original_contents = 1437 content::WebContents* original_contents =
1430 browser()->tab_strip_model()->GetActiveWebContents(); 1438 browser()->tab_strip_model()->GetActiveWebContents();
1431 content::WebContents* contents = 1439 content::WebContents* contents =
1432 content::WebContents::Create(content::WebContents::CreateParams( 1440 content::WebContents::Create(content::WebContents::CreateParams(
1433 original_contents->GetBrowserContext())); 1441 original_contents->GetBrowserContext()));
1434 ASSERT_TRUE(contents); 1442 ASSERT_TRUE(contents);
1435 contents->SetDelegate(delegate); 1443 contents->SetDelegate(delegate);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 delegate->set_console_message_callback(second_message.QuitClosure()); 1500 delegate->set_console_message_callback(second_message.QuitClosure());
1493 contents->OnPasswordInputShownOnHttp(); 1501 contents->OnPasswordInputShownOnHttp();
1494 second_message.Run(); 1502 second_message.Run();
1495 1503
1496 client->GetSecurityInfo(&security_info); 1504 client->GetSecurityInfo(&security_info);
1497 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING, 1505 EXPECT_EQ(security_state::SecurityStateModel::HTTP_SHOW_WARNING,
1498 security_info.security_level); 1506 security_info.security_level);
1499 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); 1507 ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate));
1500 } 1508 }
1501 1509
1510 INSTANTIATE_TEST_CASE_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1511 ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
1512 // Here 'true' means that the omnibox warning + form
1513 // warning are enabled, and 'false' means just the
1514 // omnibox warning is enabled.
1515 testing::Bool());
1516
1502 // Tests that the SecurityStateModel for a WebContents is up to date 1517 // Tests that the SecurityStateModel for a WebContents is up to date
1503 // when the WebContents is inserted into a Browser's TabStripModel. 1518 // when the WebContents is inserted into a Browser's TabStripModel.
1504 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { 1519 IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) {
1505 ASSERT_TRUE(https_server_.Start()); 1520 ASSERT_TRUE(https_server_.Start());
1506 SetUpMockCertVerifierForHttpsServer(0, net::OK); 1521 SetUpMockCertVerifierForHttpsServer(0, net::OK);
1507 1522
1508 content::WebContents* tab = 1523 content::WebContents* tab =
1509 browser()->tab_strip_model()->GetActiveWebContents(); 1524 browser()->tab_strip_model()->GetActiveWebContents();
1510 ASSERT_TRUE(tab); 1525 ASSERT_TRUE(tab);
1511 1526
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 ChromeSecurityStateModelClient* model_client = 2064 ChromeSecurityStateModelClient* model_client =
2050 ChromeSecurityStateModelClient::FromWebContents(web_contents); 2065 ChromeSecurityStateModelClient::FromWebContents(web_contents);
2051 ASSERT_TRUE(model_client); 2066 ASSERT_TRUE(model_client);
2052 SecurityStateModel::SecurityInfo security_info; 2067 SecurityStateModel::SecurityInfo security_info;
2053 model_client->GetSecurityInfo(&security_info); 2068 model_client->GetSecurityInfo(&security_info);
2054 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level); 2069 EXPECT_EQ(SecurityStateModel::SECURE, security_info.security_level);
2055 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); 2070 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses);
2056 } 2071 }
2057 2072
2058 } // namespace 2073 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/security_state/security_state_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698