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

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

Issue 2463703002: Optimize KURL protocols (Closed)
Patch Set: 16 bit test Created 4 years, 1 month 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 13cdda7e8d3df67f7cca018b38c393448108ba8c..41d63119e8d1acee470471127ce4b89c931ea804 100644
--- a/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/KURLTest.cpp
@@ -367,46 +367,47 @@ TEST(KURLTest, Valid_HTTP_FTP_URLsHaveHosts) {
url::AddStandardScheme("http-so", url::SCHEME_WITH_PORT);
url::AddStandardScheme("https-so", url::SCHEME_WITH_PORT);
- KURL kurl;
+ KURL kurl(ParsedURLString, "foo://www.google.com/");
EXPECT_TRUE(kurl.setProtocol("http"));
EXPECT_TRUE(kurl.protocolIs("http"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_TRUE(kurl.protocolIsInHTTPFamily());
+ EXPECT_TRUE(kurl.isValid());
EXPECT_TRUE(kurl.setProtocol("http-so"));
EXPECT_TRUE(kurl.protocolIs("http-so"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_TRUE(kurl.isValid());
EXPECT_TRUE(kurl.setProtocol("https"));
EXPECT_TRUE(kurl.protocolIs("https"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_TRUE(kurl.isValid());
EXPECT_TRUE(kurl.setProtocol("https-so"));
EXPECT_TRUE(kurl.protocolIs("https-so"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_TRUE(kurl.isValid());
EXPECT_TRUE(kurl.setProtocol("ftp"));
EXPECT_TRUE(kurl.protocolIs("ftp"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_TRUE(kurl.isValid());
kurl = KURL(KURL(), "http://");
+ EXPECT_FALSE(kurl.protocolIs("http"));
+ EXPECT_TRUE(kurl.protocolIs(""));
+
+ kurl = KURL(KURL(), "http://wide#ιΈ‘");
EXPECT_TRUE(kurl.protocolIs("http"));
- EXPECT_FALSE(kurl.isValid());
+ EXPECT_EQ(kurl.protocol(), "http");
- kurl = KURL(KURL(), "http-so://");
+ kurl = KURL(KURL(), "http-so://foo");
EXPECT_TRUE(kurl.protocolIs("http-so"));
- EXPECT_FALSE(kurl.isValid());
- kurl = KURL(KURL(), "https://");
+ kurl = KURL(KURL(), "https://foo");
EXPECT_TRUE(kurl.protocolIs("https"));
- EXPECT_FALSE(kurl.isValid());
- kurl = KURL(KURL(), "https-so://");
+ kurl = KURL(KURL(), "https-so://foo");
EXPECT_TRUE(kurl.protocolIs("https-so"));
- EXPECT_FALSE(kurl.isValid());
- kurl = KURL(KURL(), "ftp://");
+ kurl = KURL(KURL(), "ftp://foo");
EXPECT_TRUE(kurl.protocolIs("ftp"));
- EXPECT_FALSE(kurl.isValid());
kurl = KURL(KURL(), "http://host/");
EXPECT_TRUE(kurl.isValid());

Powered by Google App Engine
This is Rietveld 408576698