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

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

Issue 1723753002: Make Document::isSecureContext() work for OOPIFs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test tweaks, remove unnecessarily #include Created 4 years, 10 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/SecurityOriginTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
index c04fd588b23c3ad4a3ebd75a33e80dac9768bbd8..d405a0d253d023f1c2482d79ddd4427c70aa9c19 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -33,6 +33,7 @@
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/blob/BlobURL.h"
#include "platform/weborigin/KURL.h"
+#include "platform/weborigin/SchemeRegistry.h"
#include "platform/weborigin/SecurityPolicy.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "wtf/text/StringBuilder.h"
@@ -163,6 +164,24 @@ TEST_F(SecurityOriginTest, IsPotentiallyTrustworthy)
// Unique origins are not considered secure.
RefPtr<SecurityOrigin> uniqueOrigin = SecurityOrigin::createUnique();
EXPECT_FALSE(uniqueOrigin->isPotentiallyTrustworthy());
+
+ // ... unless they are specially marked as such.
+ uniqueOrigin->setIsPotentiallyTrustworthySandboxedOrigin();
+ EXPECT_TRUE(uniqueOrigin->isPotentiallyTrustworthy());
+}
+
+TEST_F(SecurityOriginTest, BypassSecureContextCheck)
+{
+ RefPtr<SecurityOrigin> origin1 = SecurityOrigin::createFromString("http://www.example.test");
+ EXPECT_FALSE(origin1->bypassSecureContextCheck());
+ SchemeRegistry::registerURLSchemeBypassingSecureContextCheck("special-scheme");
+ RefPtr<SecurityOrigin> origin2 = SecurityOrigin::createFromString("special-scheme://example.test");
+ EXPECT_TRUE(origin2->bypassSecureContextCheck());
+
+ RefPtr<SecurityOrigin> uniqueOrigin1 = SecurityOrigin::createUnique();
+ EXPECT_FALSE(uniqueOrigin1->bypassSecureContextCheck());
+ RefPtr<SecurityOrigin> uniqueOrigin2 = SecurityOrigin::createUnique(true /* potentially trustworthy */, true /* bypass secure context check */);
+ EXPECT_TRUE(uniqueOrigin2->bypassSecureContextCheck());
}
TEST_F(SecurityOriginTest, IsSecure)

Powered by Google App Engine
This is Rietveld 408576698