Title: [261473] trunk
Revision
261473
Author
[email protected]
Date
2020-05-11 02:47:59 -0700 (Mon, 11 May 2020)

Log Message

[GTK] Media and audio permission request unit tests are timing out
https://bugs.webkit.org/show_bug.cgi?id=158257

Patch by Philippe Normand <[email protected]> on 2020-05-11
Reviewed by Carlos Garcia Campos.

Source/WebKit:

Add new private API to disable secure capture device contexts.
This is needed for the API tests.

* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewSetMediaCaptureRequiresSecureConnection):
* UIProcess/API/glib/WebKitWebViewPrivate.h:

Tools:

Fix getUserMedia glib tests. They require unsecure capture device context.

* TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp:
(testWebViewUserMediaEnumerateDevicesPermissionCheck):
(testWebViewUserMediaPermissionRequests):
(testWebViewAudioOnlyUserMediaPermissionRequests):
* TestWebKitAPI/glib/TestExpectations.json:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (261472 => 261473)


--- trunk/Source/WebKit/ChangeLog	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Source/WebKit/ChangeLog	2020-05-11 09:47:59 UTC (rev 261473)
@@ -1,3 +1,17 @@
+2020-05-11  Philippe Normand  <[email protected]>
+
+        [GTK] Media and audio permission request unit tests are timing out
+        https://bugs.webkit.org/show_bug.cgi?id=158257
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add new private API to disable secure capture device contexts.
+        This is needed for the API tests.
+
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkitWebViewSetMediaCaptureRequiresSecureConnection):
+        * UIProcess/API/glib/WebKitWebViewPrivate.h:
+
 2020-05-10  Basuke Suzuki  <[email protected]>
 
         Add ENABLE_PERIODIC_MEMORY_MONITOR flag.

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp (261472 => 261473)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2020-05-11 09:47:59 UTC (rev 261473)
@@ -3802,3 +3802,9 @@
     priv->preferences->setMediaEnabled(enabled);
     g_object_notify(G_OBJECT(settings), "enable-media");
 }
+
+void webkitSettingsSetMediaCaptureRequiresSecureConnection(WebKitSettings* settings, bool required)
+{
+    WebKitSettingsPrivate* priv = settings->priv;
+    priv->preferences->setMediaCaptureRequiresSecureConnection(required);
+}

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitSettingsPrivate.h (261472 => 261473)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitSettingsPrivate.h	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitSettingsPrivate.h	2020-05-11 09:47:59 UTC (rev 261473)
@@ -31,4 +31,6 @@
 
 WebKit::WebPreferences* webkitSettingsGetPreferences(WebKitSettings*);
 
+void webkitSettingsSetMediaCaptureRequiresSecureConnection(WebKitSettings*, bool required);
+
 #endif // WebKitSettingsPrivate_h

Modified: trunk/Tools/ChangeLog (261472 => 261473)


--- trunk/Tools/ChangeLog	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Tools/ChangeLog	2020-05-11 09:47:59 UTC (rev 261473)
@@ -1,3 +1,18 @@
+2020-05-11  Philippe Normand  <[email protected]>
+
+        [GTK] Media and audio permission request unit tests are timing out
+        https://bugs.webkit.org/show_bug.cgi?id=158257
+
+        Reviewed by Carlos Garcia Campos.
+
+        Fix getUserMedia glib tests. They require unsecure capture device context.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp:
+        (testWebViewUserMediaEnumerateDevicesPermissionCheck):
+        (testWebViewUserMediaPermissionRequests):
+        (testWebViewAudioOnlyUserMediaPermissionRequests):
+        * TestWebKitAPI/glib/TestExpectations.json:
+
 2020-05-11  Paulo Matos  <[email protected]>
 
         Fix typo 'Detacted' -> 'Detected'

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp (261472 => 261473)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestUIClient.cpp	2020-05-11 09:47:59 UTC (rev 261473)
@@ -18,6 +18,12 @@
  */
 
 #include "config.h"
+
+// Include WebKitSettingsPrivate.h for webkitSettingsSetMediaCaptureRequiresSecureConnection().
+#define WEBKIT2_COMPILATION
+#include "WebKitSettingsPrivate.h"
+#undef WEBKIT2_COMPILATION
+
 #include "WebViewTest.h"
 #include <wtf/HashSet.h>
 #include <wtf/RunLoop.h>
@@ -889,6 +895,8 @@
     WebKitSettings* settings = webkit_web_view_get_settings(test->m_webView);
     gboolean enabled = webkit_settings_get_enable_media_stream(settings);
     webkit_settings_set_enable_media_stream(settings, TRUE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, FALSE);
+    webkit_settings_set_enable_mock_capture_devices(settings, TRUE);
 
 #if PLATFORM(GTK)
     test->showInWindowAndWaitUntilMapped();
@@ -923,6 +931,8 @@
     test->waitUntilTitleChangedTo("OK");
 
     webkit_settings_set_enable_media_stream(settings, enabled);
+    webkit_settings_set_enable_mock_capture_devices(settings, FALSE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, TRUE);
 }
 
 static void testWebViewUserMediaPermissionRequests(UIClientTest* test, gconstpointer)
@@ -930,18 +940,19 @@
     WebKitSettings* settings = webkit_web_view_get_settings(test->m_webView);
     gboolean enabled = webkit_settings_get_enable_media_stream(settings);
     webkit_settings_set_enable_media_stream(settings, TRUE);
+    webkit_settings_set_enable_mock_capture_devices(settings, TRUE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, FALSE);
 
 #if PLATFORM(GTK)
     test->showInWindowAndWaitUntilMapped();
 #endif
-    static const char* userMediaRequestHTML =
-        "<html>"
+    static const char* userMediaRequestHTML = "<html>"
         "  <script>"
         "  function runTest()"
         "  {"
-        "    navigator.webkitGetUserMedia({audio: true, video: true},"
-        "                                 function(s) { document.title = \"OK\" },"
-        "                                 function(e) { document.title = e.name });"
+        "    navigator.mediaDevices.getUserMedia({audio: true, video: true})"
+        "    .then((stream) => { document.title = \"OK\"; })"
+        "    .catch((e) => { document.title = e.name; });"
         "  }"
         "  </script>"
         "  <body _onload_='runTest();'></body>"
@@ -954,7 +965,7 @@
     // Test denying a permission request.
     test->m_allowPermissionRequests = false;
     test->loadHtml(userMediaRequestHTML, nullptr);
-    test->waitUntilTitleChangedTo("PermissionDeniedError");
+    test->waitUntilTitleChangedTo("NotAllowedError");
 
     // Test allowing a permission request.
     test->m_allowPermissionRequests = true;
@@ -962,6 +973,8 @@
     test->waitUntilTitleChangedTo("OK");
 
     webkit_settings_set_enable_media_stream(settings, enabled);
+    webkit_settings_set_enable_mock_capture_devices(settings, FALSE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, TRUE);
 }
 
 static void testWebViewAudioOnlyUserMediaPermissionRequests(UIClientTest* test, gconstpointer)
@@ -969,18 +982,19 @@
     WebKitSettings* settings = webkit_web_view_get_settings(test->m_webView);
     gboolean enabled = webkit_settings_get_enable_media_stream(settings);
     webkit_settings_set_enable_media_stream(settings, TRUE);
+    webkit_settings_set_enable_mock_capture_devices(settings, TRUE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, FALSE);
 
 #if PLATFORM(GTK)
     test->showInWindowAndWaitUntilMapped();
 #endif
-    static const char* userMediaRequestHTML =
-        "<html>"
+    static const char* userMediaRequestHTML = "<html>"
         "  <script>"
         "  function runTest()"
         "  {"
-        "    navigator.webkitGetUserMedia({audio: true, video: false},"
-        "                                 function(s) { document.title = \"OK\" },"
-        "                                 function(e) { document.title = e.name });"
+        "    navigator.mediaDevices.getUserMedia({audio: true, video: false})"
+        "    .then((stream) => { document.title = \"OK\"; })"
+        "    .catch((e) => { document.title = e.name; });"
         "  }"
         "  </script>"
         "  <body _onload_='runTest();'></body>"
@@ -993,9 +1007,11 @@
     // Test denying a permission request.
     test->m_allowPermissionRequests = false;
     test->loadHtml(userMediaRequestHTML, nullptr);
-    test->waitUntilTitleChangedTo("PermissionDeniedError");
+    test->waitUntilTitleChangedTo("NotAllowedError");
 
     webkit_settings_set_enable_media_stream(settings, enabled);
+    webkit_settings_set_enable_mock_capture_devices(settings, FALSE);
+    webkitSettingsSetMediaCaptureRequiresSecureConnection(settings, TRUE);
 }
 #endif // ENABLE(MEDIA_STREAM)
 

Modified: trunk/Tools/TestWebKitAPI/glib/TestExpectations.json (261472 => 261473)


--- trunk/Tools/TestWebKitAPI/glib/TestExpectations.json	2020-05-11 09:23:07 UTC (rev 261472)
+++ trunk/Tools/TestWebKitAPI/glib/TestExpectations.json	2020-05-11 09:47:59 UTC (rev 261473)
@@ -4,15 +4,6 @@
             "/webkit/WebKitWebView/mouse-target": {
                 "expected": {"gtk": {"status": ["TIMEOUT", "FAIL"], "bug": "webkit.org/b/117689"}}
             },
-            "/webkit/WebKitWebView/usermedia-enumeratedevices-permission-check" : {
-                "expected": {"gtk": {"status": ["TIMEOUT"], "bug": "webkit.org/b/158257"}}
-            },
-            "/webkit/WebKitWebView/usermedia-permission-requests": {
-                "expected": {"gtk": {"status": ["TIMEOUT"], "bug": "webkit.org/b/158257"}}
-            },
-            "/webkit/WebKitWebView/audio-usermedia-permission-request": {
-                "expected": {"gtk": {"status": ["TIMEOUT"], "bug": "webkit.org/b/158257"}}
-            },
             "/webkit/WebKitWebView/pointer-lock-permission-request": {
                 "expected": {"gtk": {"status": ["TIMEOUT"], "bug": "webkit.org/b/205266"}}
             }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to