Index: Source/platform/weborigin/SecurityOriginTest.cpp |
diff --git a/Source/platform/weborigin/SecurityOriginTest.cpp b/Source/platform/weborigin/SecurityOriginTest.cpp |
index 947f36c97827544604f59b5722fba6cc25310d59..aed3b260ed5cb6baa9628213c4ca1857630892af 100644 |
--- a/Source/platform/weborigin/SecurityOriginTest.cpp |
+++ b/Source/platform/weborigin/SecurityOriginTest.cpp |
@@ -362,4 +362,27 @@ TEST_F(SecurityOriginTest, EffectivePort) |
} |
} |
+TEST_F(SecurityOriginTest, CreateFromTuple) |
+{ |
+ struct TestCase { |
+ const char* scheme; |
+ const char* host; |
+ unsigned short port; |
+ 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://"}, |
jochen (gone - plz use gerrit)
2015/07/31 08:15:01
Hm, file: can have a host, no?
Mike West
2015/07/31 15:21:27
Yup. We serialize every `file:` URL as `file://` a
|
+ }; |
+ |
+ for (const auto& test : cases) { |
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(test.scheme, test.host, test.port); |
+ EXPECT_EQ(test.origin, origin->toString()) << test.origin; |
+ } |
+ |
+} |
+ |
} // namespace blink |