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

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

Issue 2449233002: Add suborigins to WebSecurityOrigin (Closed)
Patch Set: Rebase on ToT Created 4 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/SecurityOriginTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
index 1df9cb0d7a7141d7d1a860ecdf05d58ae139ba0d..7c6af427bca9dd666c2f12624f01c52f51cdcee0 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -429,6 +429,36 @@ TEST_F(SecurityOriginTest, CreateFromTuple) {
}
}
+TEST_F(SecurityOriginTest, CreateFromTupleWithSuborigin) {
+ struct TestCase {
+ const char* scheme;
+ const char* host;
+ unsigned short port;
+ const char* suborigin;
+ const char* origin;
+ } cases[] = {
+ {"http", "example.com", 80, "", "http://example.com"},
+ {"http", "example.com", 81, "", "http://example.com:81"},
+ {"https", "example.com", 443, "", "https://example.com"},
+ {"https", "example.com", 444, "", "https://example.com:444"},
+ {"file", "", 0, "", "file://"},
+ {"file", "example.com", 0, "", "file://"},
+ {"http", "example.com", 80, "foobar", "http-so://foobar.example.com"},
+ {"http", "example.com", 81, "foobar", "http-so://foobar.example.com:81"},
+ {"https", "example.com", 443, "foobar", "https-so://foobar.example.com"},
+ {"https", "example.com", 444, "foobar",
+ "https-so://foobar.example.com:444"},
+ {"file", "", 0, "foobar", "file://"},
+ {"file", "example.com", 0, "foobar", "file://"},
+ };
+
+ for (const auto& test : cases) {
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(
+ test.scheme, test.host, test.port, test.suborigin);
+ EXPECT_EQ(test.origin, origin->toString()) << test.origin;
+ }
+}
+
TEST_F(SecurityOriginTest, UniquenessPropagatesToBlobUrls) {
struct TestCase {
const char* url;

Powered by Google App Engine
This is Rietveld 408576698