Title: [206220] trunk/Tools
Revision
206220
Author
achristen...@apple.com
Date
2016-09-21 11:04:39 -0700 (Wed, 21 Sep 2016)

Log Message

Prepare API tests for enabling URLParser by default
https://bugs.webkit.org/show_bug.cgi?id=162341

Reviewed by Tim Horton.

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::checkURL):
(TestWebKitAPI::checkRelativeURL):
(TestWebKitAPI::checkURLDifferences):
(TestWebKitAPI::checkRelativeURLDifferences):
(TestWebKitAPI::shouldFail):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (206219 => 206220)


--- trunk/Tools/ChangeLog	2016-09-21 18:02:52 UTC (rev 206219)
+++ trunk/Tools/ChangeLog	2016-09-21 18:04:39 UTC (rev 206220)
@@ -1,5 +1,19 @@
 2016-09-21  Alex Christensen  <achristen...@webkit.org>
 
+        Prepare API tests for enabling URLParser by default
+        https://bugs.webkit.org/show_bug.cgi?id=162341
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::checkURL):
+        (TestWebKitAPI::checkRelativeURL):
+        (TestWebKitAPI::checkURLDifferences):
+        (TestWebKitAPI::checkRelativeURLDifferences):
+        (TestWebKitAPI::shouldFail):
+
+2016-09-21  Alex Christensen  <achristen...@webkit.org>
+
         URLParser: Correctly parse URLs that are just nonspecialscheme:/
         https://bugs.webkit.org/show_bug.cgi?id=162340
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206219 => 206220)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-21 18:02:52 UTC (rev 206219)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-21 18:04:39 UTC (rev 206220)
@@ -59,8 +59,13 @@
 
 static void checkURL(const String& urlString, const ExpectedParts& parts)
 {
-    URLParser parser;
-    auto url = ""
+    bool wasEnabled = URLParser::enabled();
+    URLParser::setEnabled(true);
+    auto url = "" urlString);
+    URLParser::setEnabled(false);
+    auto oldURL = URL(URL(), urlString);
+    URLParser::setEnabled(wasEnabled);
+    
     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
     EXPECT_TRUE(eq(parts.user, url.user()));
     EXPECT_TRUE(eq(parts.password, url.pass()));
@@ -71,7 +76,6 @@
     EXPECT_TRUE(eq(parts.fragment, url.fragmentIdentifier()));
     EXPECT_TRUE(eq(parts.string, url.string()));
     
-    auto oldURL = URL(URL(), urlString);
     EXPECT_TRUE(eq(parts.protocol, oldURL.protocol()));
     EXPECT_TRUE(eq(parts.user, oldURL.user()));
     EXPECT_TRUE(eq(parts.password, oldURL.pass()));
@@ -224,11 +228,13 @@
 
 static void checkRelativeURL(const String& urlString, const String& baseURLString, const ExpectedParts& parts)
 {
-    URLParser baseParser;
-    auto base = baseParser.parse(baseURLString);
+    bool wasEnabled = URLParser::enabled();
+    URLParser::setEnabled(true);
+    auto url = "" baseURLString), urlString);
+    URLParser::setEnabled(false);
+    auto oldURL = URL(URL(URL(), baseURLString), urlString);
+    URLParser::setEnabled(wasEnabled);
 
-    URLParser parser;
-    auto url = "" base);
     EXPECT_TRUE(eq(parts.protocol, url.protocol()));
     EXPECT_TRUE(eq(parts.user, url.user()));
     EXPECT_TRUE(eq(parts.password, url.pass()));
@@ -239,7 +245,6 @@
     EXPECT_TRUE(eq(parts.fragment, url.fragmentIdentifier()));
     EXPECT_TRUE(eq(parts.string, url.string()));
 
-    auto oldURL = URL(URL(URL(), baseURLString), urlString);
     EXPECT_TRUE(eq(parts.protocol, oldURL.protocol()));
     EXPECT_TRUE(eq(parts.user, oldURL.user()));
     EXPECT_TRUE(eq(parts.password, oldURL.pass()));
@@ -314,8 +319,13 @@
 
 static void checkURLDifferences(const String& urlString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
 {
-    URLParser parser;
-    auto url = ""
+    bool wasEnabled = URLParser::enabled();
+    URLParser::setEnabled(true);
+    auto url = "" urlString);
+    URLParser::setEnabled(false);
+    auto oldURL = URL(URL(), urlString);
+    URLParser::setEnabled(wasEnabled);
+
     EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
     EXPECT_TRUE(eq(partsNew.user, url.user()));
     EXPECT_TRUE(eq(partsNew.password, url.pass()));
@@ -326,7 +336,6 @@
     EXPECT_TRUE(eq(partsNew.fragment, url.fragmentIdentifier()));
     EXPECT_TRUE(eq(partsNew.string, url.string()));
     
-    auto oldURL = URL(URL(), urlString);
     EXPECT_TRUE(eq(partsOld.protocol, oldURL.protocol()));
     EXPECT_TRUE(eq(partsOld.user, oldURL.user()));
     EXPECT_TRUE(eq(partsOld.password, oldURL.pass()));
@@ -344,11 +353,13 @@
 
 static void checkRelativeURLDifferences(const String& urlString, const String& baseURLString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
 {
-    URLParser baseParser;
-    auto base = baseParser.parse(baseURLString);
-    
-    URLParser parser;
-    auto url = "" base);
+    bool wasEnabled = URLParser::enabled();
+    URLParser::setEnabled(true);
+    auto url = "" baseURLString), urlString);
+    URLParser::setEnabled(false);
+    auto oldURL = URL(URL(URL(), baseURLString), urlString);
+    URLParser::setEnabled(wasEnabled);
+
     EXPECT_TRUE(eq(partsNew.protocol, url.protocol()));
     EXPECT_TRUE(eq(partsNew.user, url.user()));
     EXPECT_TRUE(eq(partsNew.password, url.pass()));
@@ -359,7 +370,6 @@
     EXPECT_TRUE(eq(partsNew.fragment, url.fragmentIdentifier()));
     EXPECT_TRUE(eq(partsNew.string, url.string()));
     
-    auto oldURL = URL(URL(URL(), baseURLString), urlString);
     EXPECT_TRUE(eq(partsOld.protocol, oldURL.protocol()));
     EXPECT_TRUE(eq(partsOld.user, oldURL.user()));
     EXPECT_TRUE(eq(partsOld.password, oldURL.pass()));
@@ -661,18 +671,14 @@
     
 static void shouldFail(const String& urlString)
 {
-    URLParser parser;
-    auto invalidURL = parser.parse(urlString);
     checkURL(urlString, {"", "", "", "", 0, "", "", "", urlString});
 }
 
 static void shouldFail(const String& urlString, const String& baseString)
 {
-    URLParser parser;
-    auto invalidURL = parser.parse(urlString);
     checkRelativeURL(urlString, baseString, {"", "", "", "", 0, "", "", "", urlString});
 }
-    
+
 TEST_F(URLParserTest, ParserFailures)
 {
     shouldFail("    ");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to