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

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

Issue 1266963002: Correctly construct ("file", "", 0) SecurityOrigins. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@plugin
Patch Set: Created 5 years, 5 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
« no previous file with comments | « Source/platform/weborigin/SecurityOrigin.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/platform/weborigin/SecurityOrigin.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698