| Index: content/common/service_worker/service_worker_utils_unittest.cc
|
| diff --git a/content/browser/service_worker/service_worker_utils_unittest.cc b/content/common/service_worker/service_worker_utils_unittest.cc
|
| similarity index 56%
|
| rename from content/browser/service_worker/service_worker_utils_unittest.cc
|
| rename to content/common/service_worker/service_worker_utils_unittest.cc
|
| index d7895a43bcd725acbbf935f79af4aff00999286e..f8ab571682dc28df417d44ccb42926f24627b428 100644
|
| --- a/content/browser/service_worker/service_worker_utils_unittest.cc
|
| +++ b/content/common/service_worker/service_worker_utils_unittest.cc
|
| @@ -2,15 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/service_worker/service_worker_utils.h"
|
| +#include "content/common/service_worker/service_worker_utils.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace content {
|
|
|
| namespace {
|
|
|
| -bool IsPathRestrictionSatisfied(
|
| - const GURL& scope, const GURL& script_url) {
|
| +bool IsPathRestrictionSatisfied(const GURL& scope, const GURL& script_url) {
|
| std::string error_message;
|
| return ServiceWorkerUtils::IsPathRestrictionSatisfied(
|
| scope, script_url, nullptr, &error_message);
|
| @@ -40,8 +39,8 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) {
|
| GURL("http://www.example.com/"),
|
| GURL("https://www.example.com/page.html")));
|
|
|
| - ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
|
| - GURL("http://www.example.com/"), GURL("http://www.foo.com/")));
|
| + ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(GURL("http://www.example.com/"),
|
| + GURL("http://www.foo.com/")));
|
| ASSERT_FALSE(ServiceWorkerUtils::ScopeMatches(
|
| GURL("http://www.example.com/"), GURL("https://www.foo.com/page.html")));
|
|
|
| @@ -80,9 +79,8 @@ TEST(ServiceWorkerUtilsTest, ScopeMatches) {
|
| ASSERT_TRUE(
|
| ServiceWorkerUtils::ScopeMatches(GURL("http://www.example.com/?a=b"),
|
| GURL("http://www.example.com/?a=b")));
|
| - ASSERT_TRUE(
|
| - ServiceWorkerUtils::ScopeMatches(GURL("http://www.example.com/?a="),
|
| - GURL("http://www.example.com/?a=b")));
|
| + ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches(
|
| + GURL("http://www.example.com/?a="), GURL("http://www.example.com/?a=b")));
|
| ASSERT_TRUE(ServiceWorkerUtils::ScopeMatches(
|
| GURL("http://www.example.com/"), GURL("http://www.example.com/?a=b")));
|
|
|
| @@ -109,63 +107,49 @@ TEST(ServiceWorkerUtilsTest, FindLongestScopeMatch) {
|
| }
|
|
|
| TEST(ServiceWorkerUtilsTest, PathRestriction_Basic) {
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/"),
|
| - GURL("http://example.com/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/"),
|
| + GURL("http://example.com/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + GURL("http://example.com/"), GURL("http://example.com/foo/sw.js")));
|
| EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/bar/"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + GURL("http://example.com/bar/"), GURL("http://example.com/foo/sw.js")));
|
|
|
| // The scope is under the script directory, but that doesn't have the trailing
|
| // slash. In this case, the check should be failed.
|
| EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + GURL("http://example.com/foo"), GURL("http://example.com/foo/sw.js")));
|
|
|
| // Query parameters should not affect the path restriction.
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/?query"),
|
| - GURL("http://example.com/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/?query"),
|
| - GURL("http://example.com/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/?query"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/?query"),
|
| + GURL("http://example.com/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo/?query"),
|
| + GURL("http://example.com/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo/?query"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/?query"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/bar/query?"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + GURL("http://example.com/?query"), GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/bar/query?"),
|
| + GURL("http://example.com/foo/sw.js")));
|
|
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/"),
|
| - GURL("http://example.com/sw.js?query")));
|
| + GURL("http://example.com/"), GURL("http://example.com/sw.js?query")));
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/sw.js?query")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/sw.js?query")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/"),
|
| - GURL("http://example.com/foo/sw.js?query")));
|
| + GURL("http://example.com/foo/"), GURL("http://example.com/sw.js?query")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/sw.js?query")));
|
| EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/bar/"),
|
| - GURL("http://example.com/foo/sw.js?query")));
|
| + GURL("http://example.com/"), GURL("http://example.com/foo/sw.js?query")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/bar/"),
|
| + GURL("http://example.com/foo/sw.js?query")));
|
|
|
| // Query parameter including a slash should not affect.
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| @@ -180,31 +164,30 @@ TEST(ServiceWorkerUtils, PathRestriction_SelfReference) {
|
| // Self reference is canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/bar"),
|
| GURL("http://example.com/././foo/bar"));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/././foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/././foo/"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/./"),
|
| - GURL("http://example.com/./foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/././foo/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/././foo/"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/./"),
|
| + GURL("http://example.com/./foo/sw.js")));
|
|
|
| // URL-encoded dot ('%2e') is also canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/././bar"),
|
| GURL("http://example.com/foo/%2e/%2e/bar"));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e/%2e/bar"),
|
| - GURL("http://example.com/foo/%2e/%2e/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar"),
|
| - GURL("http://example.com/foo/%2e/%2e/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e/%2e/bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e/bar"),
|
| - GURL("http://example.com/%2e/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e/%2e/bar"),
|
| + GURL("http://example.com/foo/%2e/%2e/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar"),
|
| + GURL("http://example.com/foo/%2e/%2e/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e/%2e/bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e/bar"),
|
| + GURL("http://example.com/%2e/foo/sw.js")));
|
|
|
| // URL-encoded dot ('%2E') is also canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/././bar"),
|
| @@ -215,21 +198,21 @@ TEST(ServiceWorkerUtilsTest, PathRestriction_ParentReference) {
|
| // Parent reference is canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/bar"),
|
| GURL("http://example.com/foo/../foo/bar"));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar"),
|
| - GURL("http://example.com/foo/../foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/../foo/bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar/../bar"),
|
| - GURL("http://example.com/../foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar"),
|
| + GURL("http://example.com/foo/../foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/../foo/bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar/../bar"),
|
| + GURL("http://example.com/../foo/sw.js")));
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| GURL("http://example.com/foo/../../../foo/bar"),
|
| GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/../bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/../bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
|
|
| // URL-encoded dot ('%2e') is also canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/../foo/bar"),
|
| @@ -237,18 +220,18 @@ TEST(ServiceWorkerUtilsTest, PathRestriction_ParentReference) {
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| GURL("http://example.com/foo/bar"),
|
| GURL("http://example.com/foo/%2e%2e/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e%2e/foo/bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e%2e/foo/bar"),
|
| - GURL("http://example.com/%2e%2e/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e%2e/foo/bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e%2e/foo/bar"),
|
| + GURL("http://example.com/%2e%2e/foo/sw.js")));
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| GURL("http://example.com/foo/%2e%2e/%2e%2e/%2e%2e/foo/bar"),
|
| GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/%2e%2e/bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/%2e%2e/bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
|
|
| // URL-encoded dot ('%2E') is also canonicalized.
|
| ASSERT_EQ(GURL("http://example.com/foo/../foo/bar"),
|
| @@ -259,100 +242,98 @@ TEST(ServiceWorkerUtilsTest, PathRestriction_ConsecutiveSlashes) {
|
| // Consecutive slashes are not unified.
|
| ASSERT_NE(GURL("http://example.com/foo/bar"),
|
| GURL("http://example.com/foo///bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar"),
|
| - GURL("http://example.com/foo///sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo///bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo///bar"),
|
| - GURL("http://example.com/foo///sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar"),
|
| + GURL("http://example.com/foo///sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo///bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo///bar"),
|
| + GURL("http://example.com/foo///sw.js")));
|
| }
|
|
|
| TEST(ServiceWorkerUtilsTest, PathRestriction_BackSlash) {
|
| // A backslash is converted to a slash.
|
| ASSERT_EQ(GURL("http://example.com/foo/bar"),
|
| GURL("http://example.com/foo\\bar"));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo\\bar"),
|
| - GURL("http://example.com/foo/sw.js")));
|
| + EXPECT_TRUE(IsPathRestrictionSatisfied(GURL("http://example.com/foo\\bar"),
|
| + GURL("http://example.com/foo/sw.js")));
|
|
|
| // Consecutive back slashes should not unified.
|
| ASSERT_NE(GURL("http://example.com/foo\\\\\\bar"),
|
| GURL("http://example.com/foo\\bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo\\bar"),
|
| - GURL("http://example.com/foo\\\\\\sw.js")));
|
| - EXPECT_TRUE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo\\\\\\bar"),
|
| - GURL("http://example.com/foo\\sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo\\bar"),
|
| + GURL("http://example.com/foo\\\\\\sw.js")));
|
| + EXPECT_TRUE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo\\\\\\bar"),
|
| + GURL("http://example.com/foo\\sw.js")));
|
| }
|
|
|
| TEST(ServiceWorkerUtilsTest, PathRestriction_DisallowedCharacter) {
|
| // URL-encoded slash ('%2f') is not canonicalized.
|
| ASSERT_NE(GURL("http://example.com/foo///bar"),
|
| GURL("http://example.com/foo/%2f/bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo%2fbar/"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar%2f"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar/"),
|
| - GURL("http://example.com/foo/bar%2fsw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/bar%2fsw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo%2fbar/"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar%2f"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar/"),
|
| + GURL("http://example.com/foo/bar%2fsw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/bar%2fsw.js")));
|
|
|
| // URL-encoded slash ('%2F') is also not canonicalized.
|
| ASSERT_NE(GURL("http://example.com/foo///bar"),
|
| GURL("http://example.com/foo/%2F/bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo%2Fbar/"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar%2F"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar/"),
|
| - GURL("http://example.com/foo/bar%2Fsw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/bar%2Fsw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo%2Fbar/"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar%2F"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar/"),
|
| + GURL("http://example.com/foo/bar%2Fsw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/bar%2Fsw.js")));
|
|
|
| // URL-encoded backslash ('%5c') is not canonicalized.
|
| ASSERT_NE(GURL("http://example.com/foo/\\/bar"),
|
| GURL("http://example.com/foo/%5c/bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo%5cbar/"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar%5c"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar/"),
|
| - GURL("http://example.com/foo/bar%5csw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/bar%5csw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo%5cbar/"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar%5c"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar/"),
|
| + GURL("http://example.com/foo/bar%5csw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/bar%5csw.js")));
|
|
|
| // URL-encoded backslash ('%5C') is also not canonicalized.
|
| ASSERT_NE(GURL("http://example.com/foo/\\/bar"),
|
| GURL("http://example.com/foo/%5C/bar"));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo%5Cbar/"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar%5C"),
|
| - GURL("http://example.com/foo/bar/sw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/bar/"),
|
| - GURL("http://example.com/foo/bar%5Csw.js")));
|
| - EXPECT_FALSE(IsPathRestrictionSatisfied(
|
| - GURL("http://example.com/foo/"),
|
| - GURL("http://example.com/foo/bar%5Csw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo%5Cbar/"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar%5C"),
|
| + GURL("http://example.com/foo/bar/sw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/bar/"),
|
| + GURL("http://example.com/foo/bar%5Csw.js")));
|
| + EXPECT_FALSE(
|
| + IsPathRestrictionSatisfied(GURL("http://example.com/foo/"),
|
| + GURL("http://example.com/foo/bar%5Csw.js")));
|
|
|
| // Query parameter should be able to have escaped characters.
|
| EXPECT_TRUE(IsPathRestrictionSatisfied(
|
|
|