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

Side by Side Diff: components/security_state/security_state_model_unittest.cc

Issue 2344043003: Rename HTTP bad-related flags to be more clear (Closed)
Patch Set: sfijdf Created 4 years, 2 months 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 | « components/security_state/security_state_model.cc ('k') | components/security_state/switches.h » ('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 "components/security_state/security_state_model.h" 5 #include "components/security_state/security_state_model.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "components/security_state/security_state_model_client.h" 10 #include "components/security_state/security_state_model_client.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 SecurityStateModel::SecurityInfo security_info; 247 SecurityStateModel::SecurityInfo security_info;
248 model.GetSecurityInfo(&security_info); 248 model.GetSecurityInfo(&security_info);
249 EXPECT_TRUE(security_info.fails_malware_check); 249 EXPECT_TRUE(security_info.fails_malware_check);
250 EXPECT_EQ(SecurityStateModel::SECURITY_ERROR, security_info.security_level); 250 EXPECT_EQ(SecurityStateModel::SECURITY_ERROR, security_info.security_level);
251 } 251 }
252 252
253 // Tests that password fields cause the security level to be downgraded 253 // Tests that password fields cause the security level to be downgraded
254 // to HTTP_SHOW_WARNING when the command-line switch is set. 254 // to HTTP_SHOW_WARNING when the command-line switch is set.
255 TEST(SecurityStateModelTest, PasswordFieldWarning) { 255 TEST(SecurityStateModelTest, PasswordFieldWarning) {
256 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 256 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
257 switches::kMarkNonSecureAs, 257 switches::kMarkHttpAs,
258 switches::kMarkNonSecureWithPasswordsOrCcAsNonSecure); 258 switches::kMarkHttpWithPasswordsOrCcWithChip);
259 TestSecurityStateModelClient client; 259 TestSecurityStateModelClient client;
260 client.UseHttpUrl(); 260 client.UseHttpUrl();
261 client.set_initial_security_level(SecurityStateModel::NONE); 261 client.set_initial_security_level(SecurityStateModel::NONE);
262 SecurityStateModel model; 262 SecurityStateModel model;
263 model.SetClient(&client); 263 model.SetClient(&client);
264 client.set_displayed_password_field_on_http(true); 264 client.set_displayed_password_field_on_http(true);
265 SecurityStateModel::SecurityInfo security_info; 265 SecurityStateModel::SecurityInfo security_info;
266 model.GetSecurityInfo(&security_info); 266 model.GetSecurityInfo(&security_info);
267 EXPECT_EQ(SecurityStateModel::HTTP_SHOW_WARNING, 267 EXPECT_EQ(SecurityStateModel::HTTP_SHOW_WARNING,
268 security_info.security_level); 268 security_info.security_level);
269 } 269 }
270 270
271 // Tests that credit card fields cause the security level to be downgraded 271 // Tests that credit card fields cause the security level to be downgraded
272 // to HTTP_SHOW_WARNING when the command-line switch is set. 272 // to HTTP_SHOW_WARNING when the command-line switch is set.
273 TEST(SecurityStateModelTest, CreditCardFieldWarning) { 273 TEST(SecurityStateModelTest, CreditCardFieldWarning) {
274 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 274 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
275 switches::kMarkNonSecureAs, 275 switches::kMarkHttpAs,
276 switches::kMarkNonSecureWithPasswordsOrCcAsNonSecure); 276 switches::kMarkHttpWithPasswordsOrCcWithChip);
277 TestSecurityStateModelClient client; 277 TestSecurityStateModelClient client;
278 client.UseHttpUrl(); 278 client.UseHttpUrl();
279 client.set_initial_security_level(SecurityStateModel::NONE); 279 client.set_initial_security_level(SecurityStateModel::NONE);
280 SecurityStateModel model; 280 SecurityStateModel model;
281 model.SetClient(&client); 281 model.SetClient(&client);
282 client.set_displayed_credit_card_field_on_http(true); 282 client.set_displayed_credit_card_field_on_http(true);
283 SecurityStateModel::SecurityInfo security_info; 283 SecurityStateModel::SecurityInfo security_info;
284 model.GetSecurityInfo(&security_info); 284 model.GetSecurityInfo(&security_info);
285 EXPECT_EQ(SecurityStateModel::HTTP_SHOW_WARNING, 285 EXPECT_EQ(SecurityStateModel::HTTP_SHOW_WARNING,
286 security_info.security_level); 286 security_info.security_level);
(...skipping 11 matching lines...) Expand all
298 client.set_displayed_password_field_on_http(true); 298 client.set_displayed_password_field_on_http(true);
299 client.set_displayed_credit_card_field_on_http(true); 299 client.set_displayed_credit_card_field_on_http(true);
300 SecurityStateModel::SecurityInfo security_info; 300 SecurityStateModel::SecurityInfo security_info;
301 model.GetSecurityInfo(&security_info); 301 model.GetSecurityInfo(&security_info);
302 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level); 302 EXPECT_EQ(SecurityStateModel::NONE, security_info.security_level);
303 } 303 }
304 304
305 } // namespace 305 } // namespace
306 306
307 } // namespace security_state 307 } // namespace security_state
OLDNEW
« no previous file with comments | « components/security_state/security_state_model.cc ('k') | components/security_state/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698