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

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

Issue 2727353002: Ensure GetSecurityStyle sets correct explanations for HTTP_SHOW_WARNING (Closed)
Patch Set: Update SecurityStateContentUtilsTest Created 3 years, 9 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
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/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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 } 789 }
790 790
791 // Tests that the security level of data: URLs is always downgraded to 791 // Tests that the security level of data: URLs is always downgraded to
792 // HTTP_SHOW_WARNING. 792 // HTTP_SHOW_WARNING.
793 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, 793 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
794 SecurityLevelDowngradedOnDataUrl) { 794 SecurityLevelDowngradedOnDataUrl) {
795 content::WebContents* contents = 795 content::WebContents* contents =
796 browser()->tab_strip_model()->GetActiveWebContents(); 796 browser()->tab_strip_model()->GetActiveWebContents();
797 ASSERT_TRUE(contents); 797 ASSERT_TRUE(contents);
798 798
799 SecurityStyleTestObserver observer(contents);
800
799 SecurityStateTabHelper* helper = 801 SecurityStateTabHelper* helper =
800 SecurityStateTabHelper::FromWebContents(contents); 802 SecurityStateTabHelper::FromWebContents(contents);
801 ASSERT_TRUE(helper); 803 ASSERT_TRUE(helper);
802 804
803 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,<html></html>")); 805 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,<html></html>"));
804 security_state::SecurityInfo security_info; 806 security_state::SecurityInfo security_info;
805 helper->GetSecurityInfo(&security_info); 807 helper->GetSecurityInfo(&security_info);
806 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); 808 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
807 809
810 // Ensure Developer Tools don't show an incorrect Form Not Secure explanation.
estark 2017/03/02 22:53:33 layering-and-comment nit: it's mildly undesirable
elawrence 2017/03/02 23:11:43 Done.
811 const content::SecurityStyleExplanations& explanations =
812 observer.latest_explanations();
estark 2017/03/02 22:53:33 Perhaps also check that latest_security_style() is
elawrence 2017/03/02 23:11:43 Done.
813 EXPECT_EQ(0u, explanations.unauthenticated_explanations.size());
estark 2017/03/02 22:53:33 optional nit: since you're only using it once, I'd
elawrence 2017/03/02 23:11:43 Done.
814
808 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); 815 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
809 ASSERT_TRUE(entry); 816 ASSERT_TRUE(entry);
810 EXPECT_EQ(content::SSLStatus::NORMAL_CONTENT, entry->GetSSL().content_status); 817 EXPECT_EQ(content::SSLStatus::NORMAL_CONTENT, entry->GetSSL().content_status);
811 } 818 }
812 819
813 const char kReportURI[] = "https://report-hpkp.test"; 820 const char kReportURI[] = "https://report-hpkp.test";
814 821
815 class PKPModelClientTest : public SecurityStateTabHelperTest { 822 class PKPModelClientTest : public SecurityStateTabHelperTest {
816 public: 823 public:
817 void SetUpOnMainThread() override { 824 void SetUpOnMainThread() override {
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 SecurityStateTabHelper* helper = 2016 SecurityStateTabHelper* helper =
2010 SecurityStateTabHelper::FromWebContents(web_contents); 2017 SecurityStateTabHelper::FromWebContents(web_contents);
2011 ASSERT_TRUE(helper); 2018 ASSERT_TRUE(helper);
2012 security_state::SecurityInfo security_info; 2019 security_state::SecurityInfo security_info;
2013 helper->GetSecurityInfo(&security_info); 2020 helper->GetSecurityInfo(&security_info);
2014 EXPECT_EQ(security_state::SECURE, security_info.security_level); 2021 EXPECT_EQ(security_state::SECURE, security_info.security_level);
2015 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); 2022 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses);
2016 } 2023 }
2017 2024
2018 } // namespace 2025 } // namespace
OLDNEW
« no previous file with comments | « no previous file | components/components_chromium_strings.grd » ('j') | components/security_state/content/content_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698