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; |