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

Unified Diff: Source/weborigin/KURLTest.cpp

Issue 24095009: KURL not handling NULL m_string members properly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix regression in set-href-attribute-pathname.html Created 7 years, 3 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/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/weborigin/KURLTest.cpp
diff --git a/Source/weborigin/KURLTest.cpp b/Source/weborigin/KURLTest.cpp
index 919933384414d90abb5ab06a7fe63a62b3e8f202..91e762731480d2c1d8e1bba9106e9eb8dbfd820a 100644
--- a/Source/weborigin/KURLTest.cpp
+++ b/Source/weborigin/KURLTest.cpp
@@ -605,6 +605,42 @@ TEST(KURLTest, DeepCopy)
EXPECT_NE(dest.string().impl(), src.string().impl());
}
+TEST(KURLTest, LastPathComponent)
+{
+ WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt");
+ EXPECT_EQ("file.txt", url1.lastPathComponent());
+
+ WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
+ EXPECT_EQ(String(), invalidUTF8.lastPathComponent());
+}
+
+TEST(KURLTest, IsHierarchical)
+{
+ WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt");
+ EXPECT_TRUE(url1.isHierarchical());
+
+ WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
+ EXPECT_FALSE(invalidUTF8.isHierarchical());
+}
+
+TEST(KURLTest, PathAfterLastSlash)
+{
+ WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt");
+ EXPECT_EQ(20u, url1.pathAfterLastSlash());
+
+ WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
+ EXPECT_EQ(0u, invalidUTF8.pathAfterLastSlash());
+}
+
+TEST(KURLTest, ProtocolIsInHTTPFamily)
+{
+ WebCore::KURL url1(WebCore::ParsedURLString, "http://host/path/to/file.txt");
+ EXPECT_TRUE(url1.protocolIsInHTTPFamily());
+
+ WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:/path/to/file.txt");
+ EXPECT_FALSE(invalidUTF8.protocolIsInHTTPFamily());
+}
+
TEST(KURLTest, ProtocolIs)
{
WebCore::KURL url1(WebCore::ParsedURLString, "foo://bar");
@@ -614,6 +650,10 @@ TEST(KURLTest, ProtocolIs)
WebCore::KURL url2(WebCore::ParsedURLString, "foo-bar:");
EXPECT_TRUE(url2.protocolIs("foo-bar"));
EXPECT_FALSE(url2.protocolIs("foo"));
+
+ WebCore::KURL invalidUTF8(WebCore::ParsedURLString, "http://a@9%aa%:");
+ EXPECT_FALSE(invalidUTF8.protocolIs("http"));
+ EXPECT_TRUE(invalidUTF8.protocolIs(""));
}
} // namespace
« no previous file with comments | « Source/weborigin/KURL.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698