| 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 364cad7bc58219d3b9de3b7ce76ab990d09992ae..685e35cde38fd8de6be998278f36f393d0eb0860 100644
|
| --- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
|
| +++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
|
| @@ -341,6 +341,65 @@ TEST_F(SecurityOriginTest, CanRequest)
|
| }
|
| }
|
|
|
| +TEST_F(SecurityOriginTest, AreSamePageUrls)
|
| +{
|
| + struct TestCase {
|
| + bool areSamePageUrls;
|
| + const char* origin;
|
| + const char* url1;
|
| + const char* url2;
|
| + };
|
| +
|
| + TestCase tests[] = {
|
| + { true, "http://a.com", "http://a.com", "http://a.com" },
|
| + { true, "http://a.com", "http://a.com", "http://a.com/" },
|
| + { true, "http://a.com", "http://a.com", "http://a.com/foo" },
|
| + { true, "http://a.com", "http://a.com", "http://a.com?foo=bar" },
|
| + { true, "http://a.com", "http://a.com", "http://a.com#foo=bar" },
|
| + { true, "http://a.com", "http://a.com/path/to/something", "http://a.com" },
|
| + { true, "http://a.com", "http://a.com/path/to/something", "http://a.com/" },
|
| + { true, "http://a.com", "http://a.com/path/to/something", "http://a.com/foo" },
|
| + { true, "http://a.com", "http://a.com/path/to/something", "http://a.com?foo=bar" },
|
| + { true, "http://a.com", "http://a.com/path/to/something", "http://a.com#foo=bar" },
|
| + { true, "http://a.com:1337", "http://a.com:1337", "http://a.com:1337" },
|
| +
|
| + { false, "http://a.com:1337", "http://a.com:1337", "http://a.com:1338" },
|
| + { false, "http://a.com", "http://a.com", "https://a.com" },
|
| + { false, "http://a.com", "http://a.com", "blob:http://a.com/id" },
|
| + { false, "http://a.com", "http://a.com", "filesystem:http://a.com/path" },
|
| + { false, "http://a.com", "http://a.com", "blob:http://b.com/id" },
|
| + { false, "http://a.com", "http://a.com", "filesystem:http://b.com/path" },
|
| + { false, "http://a.com", "http://a.com", "about:blank" },
|
| + { false, "http://a.com", "http://a.com", "about:srcdoc" },
|
| + { false, "http://a.com", "about:blank", "about:blank" },
|
| + { false, "http://a.com", "about:srcdoc", "about:srcdoc" },
|
| + { false, "http://a.com", "data:,", "data:," },
|
| + { true, "http://a.com", "blob:http://a.com/id", "blob:http://a.com/id" },
|
| + { true, "http://a.com", "filesystem:http://a.com/path", "filesystem:http://a.com/path" },
|
| + { false, "http://a.com", "http://a.com", "" },
|
| + { false, "http://a.com", "", "" },
|
| +
|
| + { true, "blob:http://a.com/id", "blob:http://a.com/id", "blob:http://a.com/id" },
|
| + { false, "blob:http://a.com/id", "blob:http://a.com/id", "http://a.com/id" },
|
| + { false, "data:,", "data:,", "http://a.com" },
|
| + { false, "data:,", "data:,", "data:," },
|
| +
|
| + { true, "file:///path", "file:///path", "file:///path" },
|
| + { true, "file:///path", "file:///path", "file:///path2" },
|
| + { false, "file:///path", "file://domain/path", "file://domain/path" },
|
| + { true, "file://domain/path", "file://domain/path", "file://domain/path" },
|
| + { false, "file://domain/path", "file://domain/path", "file:///path" },
|
| + };
|
| +
|
| + for (size_t i = 0; i < arraysize(tests); ++i) {
|
| + RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(tests[i].origin);
|
| + blink::KURL url1(blink::ParsedURLString, tests[i].url1);
|
| + blink::KURL url2(blink::ParsedURLString, tests[i].url2);
|
| + EXPECT_EQ(tests[i].areSamePageUrls, origin->areSamePageUrls(url1, url2));
|
| + EXPECT_EQ(tests[i].areSamePageUrls, origin->areSamePageUrls(url2, url1));
|
| + }
|
| +}
|
| +
|
| TEST_F(SecurityOriginTest, EffectivePort)
|
| {
|
| struct TestCase {
|
|
|