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

Unified Diff: chrome/common/origin_util_unittest.cc

Issue 1072933006: Support whitelisting to handle insecure origins as trustworthy origins (chromium) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test, added IsOriginSecure plumbing etc Created 5 years, 8 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
Index: chrome/common/origin_util_unittest.cc
diff --git a/chrome/common/origin_util_unittest.cc b/chrome/common/origin_util_unittest.cc
index 63eff639db62a045145a97f0186063d84266cc4a..bb155f1400a90f32b8ad89c9ddbb7de7c462970c 100644
--- a/chrome/common/origin_util_unittest.cc
+++ b/chrome/common/origin_util_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/common/origin_util.h"
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -42,4 +44,16 @@ TEST(URLSchemesTest, IsOriginSecure) {
GURL("filesystem:ftp://127.0.0.1/temporary/")));
EXPECT_TRUE(IsOriginSecure(
GURL("filesystem:https://www.example.com/temporary/")));
+
+ // Add http://example.com and http://127.example.com to whitelist and
+ // check if they are now considered secure origins.
+ ClearWhiteListedSecureOrigins();
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ command_line->AppendSwitchASCII(
+ switches::kUnsafetyTreatInsecureOriginAsSecure,
+ "http://example.com,http://127.example.com");
+ command_line->AppendSwitch(switches::kUserDataDir);
+ EXPECT_TRUE(IsOriginSecure(GURL("http://example.com/fun.html")));
+ EXPECT_TRUE(IsOriginSecure(GURL("http://127.example.com/fun.html")));
+ ClearWhiteListedSecureOrigins();
}

Powered by Google App Engine
This is Rietveld 408576698