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

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: Nits and 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..4008b50f7d9c7fea92403161c03d7c0ba4eea7a7 100644
--- a/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SchemeRegistryTest.cpp
@@ -50,5 +50,22 @@ 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";
+
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3));
+
+ SchemeRegistry::registerURLSchemeBypassingSecureContextCheck("random-scheme");
+
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme1));
+ EXPECT_FALSE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme2));
+ EXPECT_TRUE(SchemeRegistry::schemeShouldBypassSecureContextCheck(scheme3));
robwu 2015/10/08 21:25:18 Add some tests for the uppercase random scheme, ju
jww 2015/10/09 21:39:26 Done.
+}
+
} // namespace
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698