diff options
Diffstat (limited to 'url')
-rw-r--r-- | url/origin.cc | 2 | ||||
-rw-r--r-- | url/origin_unittest.cc | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/url/origin.cc b/url/origin.cc index eb2cf14..8aaa173 100644 --- a/url/origin.cc +++ b/url/origin.cc @@ -13,7 +13,7 @@ Origin::Origin() : string_("null") {} Origin::Origin(const std::string& origin) : string_(origin) { DCHECK(origin == "null" || MatchPattern(origin, "?*://?*")); DCHECK_GT(origin.size(), 0u); - DCHECK_NE(origin[origin.size() - 1], '/'); + DCHECK(origin == "file://" || origin[origin.size() - 1] != '/'); } } // namespace url diff --git a/url/origin_unittest.cc b/url/origin_unittest.cc index d08342e..c094ee6 100644 --- a/url/origin_unittest.cc +++ b/url/origin_unittest.cc @@ -26,6 +26,11 @@ TEST(OriginTest, constructValidOrigin) { EXPECT_EQ("http://example.com:8080", origin.string()); } +TEST(OriginTest, constructValidFileOrigin) { + Origin origin("file://"); + EXPECT_EQ("file://", origin.string()); +} + TEST(OriginTest, constructValidOriginWithoutPort) { Origin origin("wss://example2.com"); EXPECT_EQ("wss://example2.com", origin.string()); |