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

Unified Diff: url/url_util_unittest.cc

Issue 2895953002: Update dangling markup mitigations. (Closed)
Patch Set: Test. Created 3 years, 7 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
Index: url/url_util_unittest.cc
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc
index 9c3606cd0e6412b49d39529593b910781ce7b300..d6746cc04ab6e7f3a14dd0092fb517ecb865e032 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -374,23 +374,32 @@ TEST(URLUtilTest, TestNoRefComponent) {
EXPECT_FALSE(resolved_parsed.ref.is_valid());
}
-TEST(URLUtilTest, RelativeWhitespaceRemoved) {
+TEST(URLUtilTest, PotentiallyDanglingMarkup) {
struct ResolveRelativeCase {
const char* base;
const char* rel;
- bool whitespace_removed;
+ bool potentially_dangling_markup;
const char* out;
} cases[] = {
- {"https://example.com/", "/path", false, "https://example.com/path"},
- {"https://example.com/", "\n/path", true, "https://example.com/path"},
- {"https://example.com/", "\r/path", true, "https://example.com/path"},
- {"https://example.com/", "\t/path", true, "https://example.com/path"},
- {"https://example.com/", "/pa\nth", true, "https://example.com/path"},
- {"https://example.com/", "/pa\rth", true, "https://example.com/path"},
- {"https://example.com/", "/pa\tth", true, "https://example.com/path"},
- {"https://example.com/", "/path\n", true, "https://example.com/path"},
- {"https://example.com/", "/path\r", true, "https://example.com/path"},
- {"https://example.com/", "/path\r", true, "https://example.com/path"},
+ {"https://example.com/", "/path<", false, "https://example.com/path%3C"},
+ {"https://example.com/", "\n/path<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "\r/path<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "\t/path<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/pa\nth<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/pa\rth<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/pa\tth<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/path\n<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/path\r<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "/path\r<", true, "https://example.com/path%3C"},
+ {"https://example.com/", "\n/<path", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "\r/<path", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "\t/<path", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<pa\nth", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<pa\rth", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<pa\tth", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<path\n", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<path\r", true, "https://example.com/%3Cpath"},
+ {"https://example.com/", "/<path\r", true, "https://example.com/%3Cpath"},
};
for (const auto& test : cases) {
@@ -407,7 +416,8 @@ TEST(URLUtilTest, RelativeWhitespaceRemoved) {
ASSERT_TRUE(valid);
output.Complete();
- EXPECT_EQ(test.whitespace_removed, resolved_parsed.whitespace_removed);
+ EXPECT_EQ(test.potentially_dangling_markup,
+ resolved_parsed.potentially_dangling_markup);
EXPECT_EQ(test.out, resolved);
}
}

Powered by Google App Engine
This is Rietveld 408576698