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

Unified Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2928453002: Add MarkHttpAsDangerous test and correct other MarkNonSecureAs tests (Closed)
Patch Set: Address review feedback Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/ssl_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index fe83aa907a7652395726717625abc553a385ffba..7bd3b57de3aa96264872e57ea41623bb8bb91bb5 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -699,6 +699,17 @@ class SSLUITest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(SSLUITest);
};
+class SSLUITestIgnoringFieldTrialConfig : public SSLUITest {
+ public:
+ SSLUITestIgnoringFieldTrialConfig() : SSLUITest() {}
+
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ // Ensure that fieldtrial_testing_config.json does not interfere.
+ command_line->AppendSwitch(
+ variations::switches::kDisableFieldTrialTestingConfig);
Ilya Sherman 2017/06/05 23:21:12 Is this still needed given that you are removing t
elawrence 2017/06/06 01:05:17 An important caveat for this CL is that we will ve
Ilya Sherman 2017/06/06 05:51:13 I see. I'm not very thrilled about this choice, a
elawrence 2017/06/06 19:50:02 Yeah, that's not great.
+ }
+};
+
class SSLUITestBlock : public SSLUITest {
public:
SSLUITestBlock() : SSLUITest() {}
@@ -1309,10 +1320,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestWSSInvalidCertAndGoForward) {
// Ensure that non-standard origins are marked correctly when the
// MarkNonSecureAs field trial is enabled.
-IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) {
+IN_PROC_BROWSER_TEST_F(SSLUITestIgnoringFieldTrialConfig, MarkFileAsNonSecure) {
scoped_refptr<base::FieldTrial> trial =
base::FieldTrialList::CreateFieldTrial(
"MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
Ilya Sherman 2017/06/05 23:21:12 If the code is launched to stable, then why do you
elawrence 2017/06/06 01:05:17 Marking of HTTP is controlled by chrome://flags#ma
+ ASSERT_TRUE(trial != nullptr);
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -1328,10 +1340,12 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MarkFileAsNonSecure) {
EXPECT_EQ(security_state::NONE, security_info.security_level);
}
-IN_PROC_BROWSER_TEST_F(SSLUITest, MarkAboutAsNonSecure) {
+IN_PROC_BROWSER_TEST_F(SSLUITestIgnoringFieldTrialConfig,
+ MarkAboutAsNonSecure) {
scoped_refptr<base::FieldTrial> trial =
base::FieldTrialList::CreateFieldTrial(
"MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
+ ASSERT_TRUE(trial != nullptr);
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -1363,10 +1377,32 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MarkDataAsNonSecure) {
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
}
-IN_PROC_BROWSER_TEST_F(SSLUITest, MarkBlobAsNonSecure) {
+// Ensure that HTTP origins are marked correctly when the MarkNonSecureAs field
+// trial is set to MarkHttpAsDangerous.
+IN_PROC_BROWSER_TEST_F(SSLUITestIgnoringFieldTrialConfig, MarkHTTPAsDangerous) {
scoped_refptr<base::FieldTrial> trial =
base::FieldTrialList::CreateFieldTrial(
"MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
+ ASSERT_TRUE(trial != nullptr);
+
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ // Navigate to a non-local HTTP page.
+ ui_test_utils::NavigateToURL(browser(), GURL("http://example.com/"));
+ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
+ SecurityStateTabHelper* helper = SecurityStateTabHelper::FromWebContents(tab);
+ ASSERT_TRUE(helper);
+
+ security_state::SecurityInfo security_info;
+ helper->GetSecurityInfo(&security_info);
+ EXPECT_EQ(security_state::DANGEROUS, security_info.security_level);
+}
+
+IN_PROC_BROWSER_TEST_F(SSLUITestIgnoringFieldTrialConfig, MarkBlobAsNonSecure) {
+ scoped_refptr<base::FieldTrial> trial =
+ base::FieldTrialList::CreateFieldTrial(
+ "MarkNonSecureAs", security_state::switches::kMarkHttpAsDangerous);
+ ASSERT_TRUE(trial != nullptr);
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
« no previous file with comments | « no previous file | testing/variations/fieldtrial_testing_config.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698