Title: [273303] trunk/Tools
Revision
273303
Author
[email protected]
Date
2021-02-23 05:01:29 -0800 (Tue, 23 Feb 2021)

Log Message

[GTK] Use std::bitset to specify WebKitTestServer's options
https://bugs.webkit.org/show_bug.cgi?id=222273

Patch by Frederic Wang <[email protected]> on 2021-02-23
Reviewed by Carlos Garcia Campos.

* TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp:
(beforeAll):
* TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp:
(WebKitTestServer::WebKitTestServer):
* TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (273302 => 273303)


--- trunk/Tools/ChangeLog	2021-02-23 12:28:20 UTC (rev 273302)
+++ trunk/Tools/ChangeLog	2021-02-23 13:01:29 UTC (rev 273303)
@@ -1,3 +1,16 @@
+2021-02-23  Frederic Wang  <[email protected]>
+
+        [GTK] Use std::bitset to specify WebKitTestServer's options
+        https://bugs.webkit.org/show_bug.cgi?id=222273
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp:
+        (beforeAll):
+        * TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp:
+        (WebKitTestServer::WebKitTestServer):
+        * TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h:
+
 2021-02-22  Alex Christensen  <[email protected]>
 
         Re-enable RangeResponseGenerator.

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp (273302 => 273303)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp	2021-02-23 12:28:20 UTC (rev 273302)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp	2021-02-23 13:01:29 UTC (rev 273303)
@@ -565,7 +565,7 @@
     kHttpsServer = new WebKitTestServer(WebKitTestServer::ServerHTTPS);
     kHttpsServer->run(httpsServerCallback);
 
-    kHttpServer = new WebKitTestServer(WebKitTestServer::ServerHTTP);
+    kHttpServer = new WebKitTestServer();
     kHttpServer->run(httpServerCallback);
 
     SSLTest::add("WebKitWebView", "ssl", testSSL);

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp (273302 => 273303)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp	2021-02-23 12:28:20 UTC (rev 273302)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp	2021-02-23 13:01:29 UTC (rev 273303)
@@ -25,9 +25,9 @@
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/threads/BinarySemaphore.h>
 
-WebKitTestServer::WebKitTestServer(ServerOptions options)
+WebKitTestServer::WebKitTestServer(ServerOptionsBitSet options)
 {
-    if (options & ServerRunInThread) {
+    if (options[ServerRunInThread]) {
         WTF::initialize();
         m_queue = WorkQueue::create("WebKitTestServer");
     }
@@ -34,7 +34,7 @@
 
     m_soupServer = adoptGRef(soup_server_new("server-header", "WebKitTestServer ", nullptr));
 
-    if (options & ServerHTTPS) {
+    if (options[ServerHTTPS]) {
         CString resourcesDir = Test::getResourcesDir();
         GUniquePtr<char> sslCertificateFile(g_build_filename(resourcesDir.data(), "test-cert.pem", nullptr));
         GUniquePtr<char> sslKeyFile(g_build_filename(resourcesDir.data(), "test-key.pem", nullptr));

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h (273302 => 273303)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h	2021-02-23 12:28:20 UTC (rev 273302)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h	2021-02-23 13:01:29 UTC (rev 273303)
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include <bitset>
 #include <libsoup/soup.h>
 #include <wtf/URL.h>
 #include <wtf/WorkQueue.h>
@@ -30,12 +31,14 @@
 public:
 
     enum ServerOptions {
-        ServerHTTP = 0,
-        ServerHTTPS = 1 << 1,
-        ServerRunInThread = 1 << 2,
+        ServerHTTPS = 0,
+        ServerRunInThread = 1,
     };
+    using ServerOptionsBitSet = std::bitset<2>;
 
-    WebKitTestServer(ServerOptions = ServerHTTP);
+    WebKitTestServer(ServerOptionsBitSet = 0);
+    WebKitTestServer(ServerOptions option)
+        : WebKitTestServer(ServerOptionsBitSet().set(option)) { }
 
     const URL& baseURL() const { return m_baseURL; }
     unsigned port() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to