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

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

Issue 1383483007: Add scheme exceptions for isSecureContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Update check for sandbox 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/SecurityPolicyTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
index fbd6a720dadb34362ac1fba52218edc2d802d778..90340d7b4d9053c39f2a22a4f34ba7652dcb6065 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicyTest.cpp
@@ -188,4 +188,21 @@ TEST(SecurityPolicyTest, TrustworthyWhiteList)
}
}
+TEST(SecurityPolicyTest, BypassSecureContextCheck)
+{
+ RefPtr<SecurityOrigin> origin1 = SecurityOrigin::createFromString("http://a.test/path/to/file.html");
+ RefPtr<SecurityOrigin> origin2 = SecurityOrigin::createFromString("https://a.test/path/to/file.html");
+ RefPtr<SecurityOrigin> origin3 = SecurityOrigin::createFromString("random-scheme://a.b/c");
+
+ EXPECT_FALSE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin1));
+ EXPECT_FALSE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin2));
+ EXPECT_FALSE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin3));
+
+ SecurityPolicy::addSchemeToBypassSecureContextWhitelist("random-scheme");
+
+ EXPECT_FALSE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin1));
+ EXPECT_FALSE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin2));
+ EXPECT_TRUE(SecurityPolicy::shouldOriginBypassSecureContextCheck(*origin3));
Mike West 2015/10/06 07:22:34 I'd like to see some tests verifying the nesting b
jww 2015/10/06 21:53:56 Can you clarify what test you'd like to see for th
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698