Title: [211174] trunk/Tools
- Revision
- 211174
- Author
- [email protected]
- Date
- 2017-01-25 15:43:01 -0800 (Wed, 25 Jan 2017)
Log Message
[ios-simulator] API test WebKit2.WebsitePoliciesAutoplayEnabled timing out
https://bugs.webkit.org/show_bug.cgi?id=167385
Patch by Matt Rajca <[email protected]> on 2017-01-25
Reviewed by Alex Christensen.
* TestWebKitAPI/Tests/WebKit2/autoplay-check.html: Avoid arbitrary timeouts in favor of promises.
* TestWebKitAPI/Tests/WebKit2/autoplay-no-audio-check.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(TEST): Allow inline (rather than full screen) media playback on iOS.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (211173 => 211174)
--- trunk/Tools/ChangeLog 2017-01-25 23:37:26 UTC (rev 211173)
+++ trunk/Tools/ChangeLog 2017-01-25 23:43:01 UTC (rev 211174)
@@ -1,3 +1,15 @@
+2017-01-25 Matt Rajca <[email protected]>
+
+ [ios-simulator] API test WebKit2.WebsitePoliciesAutoplayEnabled timing out
+ https://bugs.webkit.org/show_bug.cgi?id=167385
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/Tests/WebKit2/autoplay-check.html: Avoid arbitrary timeouts in favor of promises.
+ * TestWebKitAPI/Tests/WebKit2/autoplay-no-audio-check.html:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
+ (TEST): Allow inline (rather than full screen) media playback on iOS.
+
2017-01-25 Carlos Garcia Campos <[email protected]>
[GTK] Icon Database should be in private browsing mode for ephemeral web views
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-check.html (211173 => 211174)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-check.html 2017-01-25 23:37:26 UTC (rev 211173)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-check.html 2017-01-25 23:43:01 UTC (rev 211174)
@@ -2,21 +2,19 @@
<head>
<script>
function pageLoaded() {
- setTimeout(function() {
+ document.getElementById("video").play().then(function() {
try {
+ window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
+ } catch(e) { }
+ }).catch(function() {
+ try {
window.webkit.messageHandlers.testHandler.postMessage("did-not-play");
} catch(e) { }
- }, 100);
+ });
}
-
- function beganPlaying() {
- try {
- window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
- } catch(e) { }
- }
</script>
</head>
<body _onload_="pageLoaded()">
- <video id="video" autoplay _onplaying_=beganPlaying() src="" />
+ <video id="video" playsinline src="" />
</body>
</html>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-no-audio-check.html (211173 => 211174)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-no-audio-check.html 2017-01-25 23:37:26 UTC (rev 211173)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/autoplay-no-audio-check.html 2017-01-25 23:43:01 UTC (rev 211174)
@@ -2,21 +2,19 @@
<head>
<script>
function pageLoaded() {
- setTimeout(function() {
+ document.getElementById("video").play().then(function() {
try {
+ window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
+ } catch(e) { }
+ }).catch(function() {
+ try {
window.webkit.messageHandlers.testHandler.postMessage("did-not-play");
} catch(e) { }
- }, 100);
+ });
}
-
- function beganPlaying() {
- try {
- window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
- } catch(e) { }
- }
</script>
</head>
<body _onload_="pageLoaded()">
- <video id="video" autoplay _onplaying_=beganPlaying() src="" />
+ <video id="video" playsinline src="" />
</body>
</html>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm (211173 => 211174)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm 2017-01-25 23:37:26 UTC (rev 211173)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm 2017-01-25 23:43:01 UTC (rev 211174)
@@ -33,6 +33,10 @@
#import <WebKit/_WKWebsitePolicies.h>
#import <wtf/RetainPtr.h>
+#if PLATFORM(IOS)
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#endif
+
#if WK_API_ENABLED
static bool doneCompiling;
@@ -174,6 +178,11 @@
TEST(WebKit2, WebsitePoliciesAutoplayEnabled)
{
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+
+#if PLATFORM(IOS)
+ [configuration setAllowsInlineMediaPlayback:YES];
+#endif
+
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
auto delegate = adoptNS([[AutoplayPoliciesDelegate alloc] init]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes