Title: [292309] trunk/Tools
Revision
292309
Author
wenson_hs...@apple.com
Date
2022-04-04 12:06:56 -0700 (Mon, 04 Apr 2022)

Log Message

[iOS] Add API tests for video extraction in element fullscreen
https://bugs.webkit.org/show_bug.cgi?id=238706
rdar://91205141

Reviewed by Eric Carlson.

Add a WebKitAdditions hook for the new API test, as well as a new test page that exercises element fullscreen
with a video element.

* TestWebKitAPI/SourcesCocoa.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/FullscreenVideoExtraction.mm: Added.
* TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:
* TestWebKitAPI/Tests/WebKitCocoa/element-fullscreen.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (292308 => 292309)


--- trunk/Tools/ChangeLog	2022-04-04 18:31:37 UTC (rev 292308)
+++ trunk/Tools/ChangeLog	2022-04-04 19:06:56 UTC (rev 292309)
@@ -1,3 +1,21 @@
+2022-04-04  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iOS] Add API tests for video extraction in element fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=238706
+        rdar://91205141
+
+        Reviewed by Eric Carlson.
+
+        Add a WebKitAdditions hook for the new API test, as well as a new test page that exercises element fullscreen
+        with a video element.
+
+        * TestWebKitAPI/SourcesCocoa.txt:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKitCocoa/FullscreenVideoExtraction.mm: Added.
+        * TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/element-fullscreen.html: Added.
+        * TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm:
+
 2022-04-04  J Pascoe  <j_pas...@apple.com>
 
         [ iOS 15 ] imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.https.any.worker.html is flaky timing out

Modified: trunk/Tools/TestWebKitAPI/SourcesCocoa.txt (292308 => 292309)


--- trunk/Tools/TestWebKitAPI/SourcesCocoa.txt	2022-04-04 18:31:37 UTC (rev 292308)
+++ trunk/Tools/TestWebKitAPI/SourcesCocoa.txt	2022-04-04 19:06:56 UTC (rev 292309)
@@ -115,6 +115,7 @@
 Tests/WebKitCocoa/FullscreenDelegate.mm
 Tests/WebKitCocoa/FullscreenLayoutConstraints.mm
 Tests/WebKitCocoa/FullscreenRemoveNodeBeforeEnter.mm
+Tests/WebKitCocoa/FullscreenVideoExtraction.mm
 Tests/WebKitCocoa/GPUProcess.mm
 Tests/WebKitCocoa/Geolocation.mm
 Tests/WebKitCocoa/GetDisplayMedia.mm

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (292308 => 292309)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-04-04 18:31:37 UTC (rev 292308)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2022-04-04 19:06:56 UTC (rev 292309)
@@ -1114,6 +1114,7 @@
 		F4B825D81EF4DBFB006E417F /* compressed-files.zip in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B825D61EF4DBD4006E417F /* compressed-files.zip */; };
 		F4B86D4F20BCD5B20099A7E6 /* paint-significant-area-milestone.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */; };
 		F4BC0B142146C849002A0478 /* FocusPreservationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4BC0B132146C849002A0478 /* FocusPreservationTests.mm */; };
+		F4BDA43027F8D19C00F9647D /* element-fullscreen.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4BDA42F27F8CF5600F9647D /* element-fullscreen.html */; };
 		F4BFA68E1E4AD08000154298 /* LegacyDragAndDropTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA68C1E4AD08000154298 /* LegacyDragAndDropTests.mm */; };
 		F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; };
 		F4C8797F2059D8D3009CD00B /* ScrollViewInsetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */; };
@@ -1349,6 +1350,7 @@
 				CEDA12412437C9FB00C28A9E /* editable-region-composited-and-non-composited-overlap.html in Copy Resources */,
 				F4352F9F26D403DE00E605E4 /* editable-responsive-body.html in Copy Resources */,
 				F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */,
+				F4BDA43027F8D19C00F9647D /* element-fullscreen.html in Copy Resources */,
 				51C8E1A91F27F49600BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist in Copy Resources */,
 				A14AAB651E78DC5400C1ADC2 /* encrypted.pdf in Copy Resources */,
 				F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */,
@@ -3145,6 +3147,8 @@
 		F4B825D61EF4DBD4006E417F /* compressed-files.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "compressed-files.zip"; sourceTree = "<group>"; };
 		F4B86D4E20BCD5970099A7E6 /* paint-significant-area-milestone.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "paint-significant-area-milestone.html"; sourceTree = "<group>"; };
 		F4BC0B132146C849002A0478 /* FocusPreservationTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FocusPreservationTests.mm; sourceTree = "<group>"; };
+		F4BDA42E27F8BF2F00F9647D /* FullscreenVideoExtraction.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenVideoExtraction.mm; sourceTree = "<group>"; };
+		F4BDA42F27F8CF5600F9647D /* element-fullscreen.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "element-fullscreen.html"; sourceTree = "<group>"; };
 		F4BFA68C1E4AD08000154298 /* LegacyDragAndDropTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyDragAndDropTests.mm; sourceTree = "<group>"; };
 		F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "enormous-video-with-sound.html"; sourceTree = "<group>"; };
 		F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollViewInsetTests.mm; sourceTree = "<group>"; };
@@ -3542,6 +3546,7 @@
 				CD78E11A1DB7EA360014A2DE /* FullscreenDelegate.mm */,
 				3F1B52681D3D7129008D60C4 /* FullscreenLayoutConstraints.mm */,
 				CDDC7C6825FFF6D000224278 /* FullscreenRemoveNodeBeforeEnter.mm */,
+				F4BDA42E27F8BF2F00F9647D /* FullscreenVideoExtraction.mm */,
 				631EFFF51E7B5E8D00D2EBB8 /* Geolocation.mm */,
 				07E1F6A01FFC3A080096C7EC /* GetDisplayMedia.mm */,
 				0738012E275EADAB000FA77C /* GetDisplayMediaWindowAndScreen.mm */,
@@ -4159,6 +4164,7 @@
 				F4D9818E2196B911008230FC /* editable-nested-lists.html */,
 				F4352F9E26D4037000E605E4 /* editable-responsive-body.html */,
 				F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */,
+				F4BDA42F27F8CF5600F9647D /* element-fullscreen.html */,
 				51C8E1A81F27F47300BF731B /* EmptyGrandfatheredResourceLoadStatistics.plist */,
 				F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */,
 				F407FE381F1D0DE60017CF25 /* enormous.svg */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenVideoExtraction.mm (0 => 292309)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenVideoExtraction.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/FullscreenVideoExtraction.mm	2022-04-04 19:06:56 UTC (rev 292309)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/FullscreenVideoExtractionAdditions.mm>
+#endif

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm (292308 => 292309)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm	2022-04-04 18:31:37 UTC (rev 292308)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PushAPI.mm	2022-04-04 19:06:56 UTC (rev 292309)
@@ -37,6 +37,7 @@
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/WKWebsiteDataStorePrivate.h>
 #import <WebKit/_WKWebsiteDataStoreConfiguration.h>
+#import <wtf/HexNumber.h>
 
 static NSDictionary *messageDictionary(NSData *data, NSURL *registration)
 {

Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/element-fullscreen.html (0 => 292309)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/element-fullscreen.html	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/element-fullscreen.html	2022-04-04 19:06:56 UTC (rev 292309)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+<style>
+body, html {
+    width: 100%;
+    height: 100%;
+    margin: 0;
+}
+
+.container {
+    width: 640px;
+    height: 480px;
+    position: relative;
+    border: 1px solid red;
+}
+
+video {
+    width: 100%;
+    height: 100%;
+}
+</style>
+</head>
+<body>
+    <div class="container">
+        <video muted loop></video>
+    </div>
+</body>
+<script>
+var container = document.querySelector(".container");
+var video = document.querySelector("video");
+
+async function loadSource(source)
+{
+    return new Promise(resolve => {
+        video.addEventListener("load", resolve, { once: true });
+        video.src = ""
+    });
+}
+
+function performWithUserGestureIfPossible(callback)
+{
+    if (window.internals)
+        internals.withUserGesture(callback);
+    else
+        callback();
+}
+
+function enterFullscreen()
+{
+    if (document.webkitIsFullScreen)
+        return false;
+
+    performWithUserGestureIfPossible(() => {
+        container.webkitRequestFullscreen({ navigationUI: "hide" });
+        video.play();
+    });
+    return true;
+}
+
+function exitFullscreen()
+{
+    if (!document.webkitIsFullScreen)
+        return false;
+
+    performWithUserGestureIfPossible(() => {
+        document.webkitExitFullscreen();
+        video.pause();
+    });
+    return true;
+}
+</script>
+</html>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm (292308 => 292309)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm	2022-04-04 18:31:37 UTC (rev 292308)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm	2022-04-04 19:06:56 UTC (rev 292309)
@@ -32,6 +32,7 @@
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 #import "UIKitSPI.h"
+#import <WebKit/WKUIDelegatePrivate.h>
 #import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <WebKit/WKWebViewPrivateForTesting.h>
 #import <WebKit/WKWebpagePreferencesPrivate.h>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to