diff options
author | alexmos <alexmos@chromium.org> | 2014-11-24 21:45:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-25 05:45:35 +0000 |
commit | b27713e1dd922d7501860506a281901b6a47bfb8 (patch) | |
tree | 4b3738f63b117a61697372fed7fa55beaf14226e /url | |
parent | 3bf7cee9700d3cf14c26a169b4cee330c65cb025 (diff) | |
download | chromium_src-b27713e1dd922d7501860506a281901b6a47bfb8.zip chromium_src-b27713e1dd922d7501860506a281901b6a47bfb8.tar.gz chromium_src-b27713e1dd922d7501860506a281901b6a47bfb8.tar.bz2 |
Add support for file origins to url::Origin.
BUG=
Review URL: https://codereview.chromium.org/751543003
Cr-Commit-Position: refs/heads/master@{#305593}
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()); |