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

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

Issue 2890143002: Set 'whitespace_removed' correctly when resolving relative URLs. (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: third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
index 63c21e8f2a8ac744df11d18978670f4afaf37768..306e4856f1e2ec6708249e259bb3e2bf3d747d3a 100644
--- a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
@@ -302,7 +302,7 @@ TEST(KURLTest, EncodeWithURLEscapeSequences) {
EXPECT_EQ(EncodeWithURLEscapeSequences(precomposed), "%C4%99");
}
-TEST(KURLTest, RemoveWhitespace) {
+TEST(KURLTest, AbsoluteRemoveWhitespace) {
struct {
const char* input;
const char* expected;
@@ -333,6 +333,34 @@ TEST(KURLTest, RemoveWhitespace) {
}
}
+TEST(KURLTest, RelativeRemoveWhitespace) {
+ struct {
+ const char* base;
+ const char* relative;
+ bool whitespace_removed;
+ } cases[] = {
+ {"http://example.com/", "/path", false},
+ {"http://example.com/", "\n/path", true},
+ {"http://example.com/", "\r/path", true},
+ {"http://example.com/", "\t/path", true},
+ {"http://example.com/", "/pa\nth", true},
+ {"http://example.com/", "/pa\rth", true},
+ {"http://example.com/", "/pa\tth", true},
+ {"http://example.com/", "/path\n", true},
+ {"http://example.com/", "/path\r", true},
+ {"http://example.com/", "/path\t", true},
+ };
+
+ for (const auto& test : cases) {
+ SCOPED_TRACE(::testing::Message() << test.base << ", " << test.relative);
+ const KURL base(kParsedURLString, test.base);
+ const KURL expected(kParsedURLString, "http://example.com/path");
+ const KURL actual(base, test.relative);
+ EXPECT_EQ(actual, expected);
+ EXPECT_EQ(test.whitespace_removed, actual.WhitespaceRemoved());
+ }
+}
+
TEST(KURLTest, ResolveEmpty) {
KURL empty_base;
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/loader/url-strip-cr-lf-tab-expected.txt ('k') | url/url_canon_relative.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698