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

Unified Diff: third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp

Issue 1383483007: Add scheme exceptions for isSecureContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fixes Created 5 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
index 45386104ccbc12e5408d0feae167d7aba09cec87..957ac7b9003aeab7168f031443da80a48a460450 100644
--- a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
@@ -50,5 +50,25 @@ TEST_F(SchemeRegistryTest, PartialCSPBypass)
EXPECT_FALSE(SchemeRegistry::schemeShouldBypassContentSecurityPolicy(kTestScheme2, SchemeRegistry::PolicyAreaImage));
}
+TEST_F(SchemeRegistryTest, BypassSecureContextCheck)
+{
+ const char* scheme1 = "http";
+ const char* scheme2 = "https";
+ const char* scheme3 = "random-scheme";
+ const char* scheme4 = "RANDOM-SCHEME";
+
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme4));
+
+ SchemeRegistry::registerURLSchemeBypassingSecureContextCheck("random-scheme");
+
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2));
+ EXPECT_TRUE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3));
+ EXPECT_TRUE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme4));
+}
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698