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

Unified Diff: Source/platform/weborigin/KURLTest.cpp

Issue 610493002: adjust blink::equalIgnoringFragmentIdentifier to work better for data: (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add test Created 6 years, 2 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 | « Source/platform/weborigin/KURL.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/weborigin/KURLTest.cpp
diff --git a/Source/platform/weborigin/KURLTest.cpp b/Source/platform/weborigin/KURLTest.cpp
index 7162c946c513dc8aee68f0d1da66b668c5186bba..f9c324014010c417dde040ec5a563dd8d53b92c7 100644
--- a/Source/platform/weborigin/KURLTest.cpp
+++ b/Source/platform/weborigin/KURLTest.cpp
@@ -704,4 +704,38 @@ TEST(KURLTest, strippedForUseAsReferrer)
}
}
+TEST(KURLTest, EqualIgnoringFragmentIdentifier)
+{
+ struct FragmentIdentifierCase {
+ const char* urlA;
+ const char* urlB;
+
+ bool equal;
+ } cases[] = {
+ {
+ "http://www.example.com/foo#bar",
+ "http://www.example.com/foo#baz",
+ true,
+ }, {
+ "http://www.example.com/foo#bar",
+ "https://www.example.com/foo#baz",
+ false,
+ }, {
+ "data:text/html;charset=utf-8,<!-- http://www.example.com/demo#a -->foo",
+ "data:text/html;charset=utf-8,<!-- http://www.example.com/demo#a -->bar",
+ false,
+ }, {
+ "data:text/html;charset=utf-8,bag",
+ "data:text/html;charset=utf-8,bag",
+ true,
+ },
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
+ blink::KURL kurlA(blink::ParsedURLString, cases[i].urlA);
+ blink::KURL kurlB(blink::ParsedURLString, cases[i].urlB);
+ EXPECT_EQ(cases[i].equal, blink::equalIgnoringFragmentIdentifier(kurlA, kurlB));
+ }
+}
+
} // namespace
« no previous file with comments | « Source/platform/weborigin/KURL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698