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

Unified Diff: third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp

Issue 2196983002: Allow doc.written scripts with a matching domain and registry to execute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 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 | « third_party/WebKit/Source/platform/network/NetworkUtils.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp
diff --git a/third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp b/third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp
index d5d84f933f07435e82e55121be8774414da9dee9..d45d212fc3d6190435e08a5546e7b6fac5b9bc36 100644
--- a/third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp
+++ b/third_party/WebKit/Source/platform/network/NetworkUtilsTest.cpp
@@ -61,4 +61,29 @@ TEST(NetworkUtilsTest, IsReservedIPAddress)
}
}
+TEST(NetworkUtilsTest, GetDomainAndRegistry)
+{
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry(".", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("..", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("com", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry(".com", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("www.example.com:8000", true));
+
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("localhost", true));
+ EXPECT_EQ("", NetworkUtils::getDomainAndRegistry("127.0.0.1", true));
+
+ EXPECT_EQ("example.com", NetworkUtils::getDomainAndRegistry("example.com", true));
+ EXPECT_EQ("example.com", NetworkUtils::getDomainAndRegistry("www.example.com", true));
+ EXPECT_EQ("example.com", NetworkUtils::getDomainAndRegistry("multilevel.www.example.com", true));
+ EXPECT_EQ("example.co.uk", NetworkUtils::getDomainAndRegistry("www.example.co.uk", true));
+
+ // Verify proper handling of 'private registries'.
+ EXPECT_EQ("foo.appspot.com", NetworkUtils::getDomainAndRegistry("www.foo.appspot.com", true));
+ EXPECT_EQ("appspot.com", NetworkUtils::getDomainAndRegistry("www.foo.appspot.com", false));
shivanisha 2016/08/01 16:35:55 Can we also include the example mentioned in the c
Bryan McQuade 2016/08/01 18:43:51 Ah, replied to the overall change rather than the
+
+ // Verify that unknown registries are included.
+ EXPECT_EQ("example.notarealregistry", NetworkUtils::getDomainAndRegistry("www.example.notarealregistry", true));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/network/NetworkUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698