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

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

Issue 2666783006: [Merge M-56] Display "Not secure" verbose state for data: URLs (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | chrome/browser/ssl/ssl_browser_tests.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/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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 embedded_test_server()->host_port_pair(), &replacement_path); 726 embedded_test_server()->host_port_pair(), &replacement_path);
727 ui_test_utils::NavigateToURL(browser(), 727 ui_test_utils::NavigateToURL(browser(),
728 https_server_.GetURL(replacement_path)); 728 https_server_.GetURL(replacement_path));
729 CheckSecurityInfoForSecure( 729 CheckSecurityInfoForSecure(
730 browser()->tab_strip_model()->GetActiveWebContents(), 730 browser()->tab_strip_model()->GetActiveWebContents(),
731 security_state::DANGEROUS, security_state::NO_DEPRECATED_SHA1, 731 security_state::DANGEROUS, security_state::NO_DEPRECATED_SHA1,
732 security_state::CONTENT_STATUS_DISPLAYED, false, 732 security_state::CONTENT_STATUS_DISPLAYED, false,
733 true /* expect cert status error */); 733 true /* expect cert status error */);
734 } 734 }
735 735
736 // Tests that the security level of data: URLs is always downgraded to
737 // HTTP_SHOW_WARNING.
738 IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
739 SecurityLevelDowngradedOnDataUrl) {
740 content::WebContents* contents =
741 browser()->tab_strip_model()->GetActiveWebContents();
742 ASSERT_TRUE(contents);
743
744 SecurityStateTabHelper* helper =
745 SecurityStateTabHelper::FromWebContents(contents);
746 ASSERT_TRUE(helper);
747
748 ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,<html></html>"));
749 security_state::SecurityInfo security_info;
750 helper->GetSecurityInfo(&security_info);
751 EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
752
753 content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
754 ASSERT_TRUE(entry);
755 EXPECT_EQ(content::SSLStatus::NORMAL_CONTENT, entry->GetSSL().content_status);
756 }
757
736 const char kReportURI[] = "https://report-hpkp.test"; 758 const char kReportURI[] = "https://report-hpkp.test";
737 759
738 class PKPModelClientTest : public SecurityStateTabHelperTest { 760 class PKPModelClientTest : public SecurityStateTabHelperTest {
739 public: 761 public:
740 void SetUpOnMainThread() override { 762 void SetUpOnMainThread() override {
741 ASSERT_TRUE(https_server_.Start()); 763 ASSERT_TRUE(https_server_.Start());
742 url_request_context_getter_ = browser()->profile()->GetRequestContext(); 764 url_request_context_getter_ = browser()->profile()->GetRequestContext();
743 content::BrowserThread::PostTask( 765 content::BrowserThread::PostTask(
744 content::BrowserThread::IO, FROM_HERE, 766 content::BrowserThread::IO, FROM_HERE,
745 base::Bind(&PKPModelClientTest::SetUpOnIOThread, 767 base::Bind(&PKPModelClientTest::SetUpOnIOThread,
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 SecurityStateTabHelper* helper = 2050 SecurityStateTabHelper* helper =
2029 SecurityStateTabHelper::FromWebContents(web_contents); 2051 SecurityStateTabHelper::FromWebContents(web_contents);
2030 ASSERT_TRUE(helper); 2052 ASSERT_TRUE(helper);
2031 security_state::SecurityInfo security_info; 2053 security_state::SecurityInfo security_info;
2032 helper->GetSecurityInfo(&security_info); 2054 helper->GetSecurityInfo(&security_info);
2033 EXPECT_EQ(security_state::SECURE, security_info.security_level); 2055 EXPECT_EQ(security_state::SECURE, security_info.security_level);
2034 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses); 2056 EXPECT_EQ(kTestSCTStatuses, security_info.sct_verify_statuses);
2035 } 2057 }
2036 2058
2037 } // namespace 2059 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698