Title: [259622] trunk/Tools
- Revision
- 259622
- Author
- [email protected]
- Date
- 2020-04-06 20:39:38 -0700 (Mon, 06 Apr 2020)
Log Message
REGRESSION (r259531?): [iOS] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia is timing out
https://bugs.webkit.org/show_bug.cgi?id=210013
Reviewed by Daniel Bates.
Fix mistakes in the test and make it more reliable.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:
(-[ScrollingDoesNotPauseMediaDelegate handleEvent:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Tools/ChangeLog (259621 => 259622)
--- trunk/Tools/ChangeLog 2020-04-07 02:23:22 UTC (rev 259621)
+++ trunk/Tools/ChangeLog 2020-04-07 03:39:38 UTC (rev 259622)
@@ -1,3 +1,18 @@
+2020-04-06 Peng Liu <[email protected]>
+
+ REGRESSION (r259531?): [iOS] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia is timing out
+ https://bugs.webkit.org/show_bug.cgi?id=210013
+
+ Reviewed by Daniel Bates.
+
+ Fix mistakes in the test and make it more reliable.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm:
+ (-[ScrollingDoesNotPauseMediaDelegate handleEvent:]):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html: Added.
+
2020-04-06 Don Olmstead <[email protected]>
[CMake] Use WEBKIT_EXECUTABLE in DumpRenderTree
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (259621 => 259622)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-07 02:23:22 UTC (rev 259621)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-04-07 03:39:38 UTC (rev 259622)
@@ -115,6 +115,7 @@
1CF59AE521E6977D006E37EC /* dark-mode.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CF59AE421E696FB006E37EC /* dark-mode.html */; };
1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */; };
1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1D67BFD92433DFD8006B5047 /* two-videos.html */; };
+ 1DAA52CC243BE805001A3159 /* one-video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1DAA52CB243BE621001A3159 /* one-video.html */; };
1F83571B1D3FFB2300E3967B /* WKBackForwardList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */; };
26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; };
26F52EAD1828827B0023D412 /* geolocationGetCurrentPosition.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26F52EAC1828820E0023D412 /* geolocationGetCurrentPosition.html */; };
@@ -1454,6 +1455,7 @@
CDB5DFFF213610FA00D3E189 /* now-playing.html in Copy Resources */,
93E2D2761ED7D53200FA76F6 /* offscreen-iframe-of-media-document.html in Copy Resources */,
074994421EA5034B000DA44F /* ondevicechange.html in Copy Resources */,
+ 1DAA52CC243BE805001A3159 /* one-video.html in Copy Resources */,
CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */,
7CCB99231D3B4A46003922F6 /* open-multiple-external-url.html in Copy Resources */,
468BC45522653A1000A36C96 /* open-window-then-write-to-it.html in Copy Resources */,
@@ -1669,6 +1671,7 @@
1CF59AE421E696FB006E37EC /* dark-mode.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "dark-mode.html"; sourceTree = "<group>"; };
1D67BFD92433DFD8006B5047 /* two-videos.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-videos.html"; sourceTree = "<group>"; };
1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreemptVideoFullscreen.mm; sourceTree = "<group>"; };
+ 1DAA52CB243BE621001A3159 /* one-video.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "one-video.html"; sourceTree = "<group>"; };
1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBackForwardList.mm; path = Tests/WebKit/WKBackForwardList.mm; sourceTree = SOURCE_ROOT; };
260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; };
260BA57A1B1D2EE2004FA07C /* DFAHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFAHelpers.h; sourceTree = "<group>"; };
@@ -4343,6 +4346,7 @@
isa = PBXGroup;
children = (
CD9E292D1C90C1BA000BB800 /* audio-only.html */,
+ 1DAA52CB243BE621001A3159 /* one-video.html */,
1D67BFD92433DFD8006B5047 /* two-videos.html */,
CDC8E4891BC5C96200594FEC /* video-with-audio.html */,
CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm (259621 => 259622)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm 2020-04-07 02:23:22 UTC (rev 259621)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm 2020-04-07 03:39:38 UTC (rev 259622)
@@ -30,6 +30,7 @@
#import "PlatformUtilities.h"
#import <WebKit/DOMHTMLMediaElement.h>
#import <WebKit/WebFramePrivate.h>
+#import <WebKitLegacy/WebPreferencesPrivate.h>
#import <wtf/MainThread.h>
#import <wtf/RetainPtr.h>
@@ -37,10 +38,14 @@
}
@end
-static bool didFinishLoad;
-static bool gotMainFrame;
-static WebFrame* mainFrame;
+static bool didFinishLoad = false;
+static bool gotMainFrame = false;
+static RetainPtr<WebFrame> mainFrame;
+static bool readyToTest = false;
+static bool didReceivePause = false;
+static bool didReceivePlaying = false;
+
@implementation ScrollingDoesNotPauseMediaDelegate
IGNORE_WARNINGS_BEGIN("deprecated-implementations")
@@ -56,12 +61,11 @@
gotMainFrame = true;
}
-static bool didReceivePause;
-static bool didReceivePlaying;
-
- (void)handleEvent:(DOMEvent *)event
{
- if ([event.type isEqualToString:@"pause"])
+ if ([event.type isEqualToString:@"canplaythrough"])
+ readyToTest = true;
+ else if ([event.type isEqualToString:@"pause"])
didReceivePause = true;
else if ([event.type isEqualToString:@"playing"])
didReceivePlaying = true;
@@ -72,22 +76,20 @@
TEST(WebKitLegacy, ScrollingDoesNotPauseMedia)
{
+ RetainPtr<WebPreferences> preferences = [WebPreferences standardPreferences];
+ preferences.get().mediaDataLoadsAutomatically = YES;
+ preferences.get().mediaPlaybackAllowsInline = YES;
+ preferences.get().mediaPlaybackRequiresUserGesture = NO;
+
RetainPtr<UIWindow> uiWindow = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
RetainPtr<UIWebView> uiWebView = adoptNS([[UIWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
[uiWindow addSubview:uiWebView.get()];
- uiWebView.get().mediaPlaybackRequiresUserAction = NO;
- uiWebView.get().allowsInlineMediaPlayback = YES;
-
RetainPtr<ScrollingDoesNotPauseMediaDelegate> testController = adoptNS([ScrollingDoesNotPauseMediaDelegate new]);
uiWebView.get().delegate = testController.get();
- didFinishLoad = false;
- gotMainFrame = false;
- mainFrame = nil;
+ [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"one-video" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
- [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
-
Util::run(&didFinishLoad);
Util::run(&gotMainFrame);
@@ -94,29 +96,33 @@
callOnMainThreadAndWait([&] () mutable {
[mainFrame setTimeoutsPaused:YES];
- DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"];
+ DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];
ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
+ [video addEventListener:@"canplaythrough" listener:testController.get() useCapture:NO];
[video addEventListener:@"playing" listener:testController.get() useCapture:NO];
- didReceivePlaying = false;
- [video play];
+ [video addEventListener:@"pause" listener:testController.get() useCapture:NO];
+ [video setSrc:@"video-with-audio.mp4"];
[mainFrame setTimeoutsPaused:NO];
});
+ Util::run(&readyToTest);
+
+ callOnMainThreadAndWait([&] () mutable {
+ DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];
+ ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
+
+ [video play];
+ });
+
Util::run(&didReceivePlaying);
callOnMainThreadAndWait([&] () mutable {
- [mainFrame setTimeoutsPaused:YES];
-
- DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"];
+ DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"];
ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]);
- [video addEventListener:@"pause" listener:testController.get() useCapture:NO];
- didReceivePause = false;
[video pause];
-
- [mainFrame setTimeoutsPaused:NO];
});
Util::run(&didReceivePause);
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html (0 => 259622)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html 2020-04-07 03:39:38 UTC (rev 259622)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+ <video webkit-playsinline loop></video>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes