Changeset 259622 in webkit
- Timestamp:
- Apr 6, 2020 8:39:38 PM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r259617 r259622 1 2020-04-06 Peng Liu <peng.liu6@apple.com> 2 3 REGRESSION (r259531?): [iOS] TestWebKitAPI.WebKitLegacy.ScrollingDoesNotPauseMedia is timing out 4 https://bugs.webkit.org/show_bug.cgi?id=210013 5 6 Reviewed by Daniel Bates. 7 8 Fix mistakes in the test and make it more reliable. 9 10 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 11 * TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm: 12 (-[ScrollingDoesNotPauseMediaDelegate handleEvent:]): 13 (TestWebKitAPI::TEST): 14 * TestWebKitAPI/Tests/WebKitLegacy/ios/one-video.html: Added. 15 1 16 2020-04-06 Don Olmstead <don.olmstead@sony.com> 2 17 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r259531 r259622 116 116 1D67BFDC2433E0A7006B5047 /* PreemptVideoFullscreen.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */; }; 117 117 1D67BFDD2433EE66006B5047 /* two-videos.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1D67BFD92433DFD8006B5047 /* two-videos.html */; }; 118 1DAA52CC243BE805001A3159 /* one-video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1DAA52CB243BE621001A3159 /* one-video.html */; }; 118 119 1F83571B1D3FFB2300E3967B /* WKBackForwardList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */; }; 119 120 26DF5A6315A2A27E003689C2 /* CancelLoadFromResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */; }; … … 1455 1456 93E2D2761ED7D53200FA76F6 /* offscreen-iframe-of-media-document.html in Copy Resources */, 1456 1457 074994421EA5034B000DA44F /* ondevicechange.html in Copy Resources */, 1458 1DAA52CC243BE805001A3159 /* one-video.html in Copy Resources */, 1457 1459 CEA6CF2819CCF69D0064F5A7 /* open-and-close-window.html in Copy Resources */, 1458 1460 7CCB99231D3B4A46003922F6 /* open-multiple-external-url.html in Copy Resources */, … … 1670 1672 1D67BFD92433DFD8006B5047 /* two-videos.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-videos.html"; sourceTree = "<group>"; }; 1671 1673 1D67BFDB2433E0A7006B5047 /* PreemptVideoFullscreen.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreemptVideoFullscreen.mm; sourceTree = "<group>"; }; 1674 1DAA52CB243BE621001A3159 /* one-video.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "one-video.html"; sourceTree = "<group>"; }; 1672 1675 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKBackForwardList.mm; path = Tests/WebKit/WKBackForwardList.mm; sourceTree = SOURCE_ROOT; }; 1673 1676 260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFACombiner.cpp; sourceTree = "<group>"; }; … … 4344 4347 children = ( 4345 4348 CD9E292D1C90C1BA000BB800 /* audio-only.html */, 4349 1DAA52CB243BE621001A3159 /* one-video.html */, 4346 4350 1D67BFD92433DFD8006B5047 /* two-videos.html */, 4347 4351 CDC8E4891BC5C96200594FEC /* video-with-audio.html */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/ScrollingDoesNotPauseMedia.mm
r255116 r259622 31 31 #import <WebKit/DOMHTMLMediaElement.h> 32 32 #import <WebKit/WebFramePrivate.h> 33 #import <WebKitLegacy/WebPreferencesPrivate.h> 33 34 #import <wtf/MainThread.h> 34 35 #import <wtf/RetainPtr.h> … … 38 39 @end 39 40 40 static bool didFinishLoad; 41 static bool gotMainFrame; 42 static WebFrame* mainFrame; 41 static bool didFinishLoad = false; 42 static bool gotMainFrame = false; 43 static RetainPtr<WebFrame> mainFrame; 44 45 static bool readyToTest = false; 46 static bool didReceivePause = false; 47 static bool didReceivePlaying = false; 43 48 44 49 @implementation ScrollingDoesNotPauseMediaDelegate … … 57 62 } 58 63 59 static bool didReceivePause;60 static bool didReceivePlaying;61 62 64 - (void)handleEvent:(DOMEvent *)event 63 65 { 64 if ([event.type isEqualToString:@"pause"]) 66 if ([event.type isEqualToString:@"canplaythrough"]) 67 readyToTest = true; 68 else if ([event.type isEqualToString:@"pause"]) 65 69 didReceivePause = true; 66 70 else if ([event.type isEqualToString:@"playing"]) … … 73 77 TEST(WebKitLegacy, ScrollingDoesNotPauseMedia) 74 78 { 79 RetainPtr<WebPreferences> preferences = [WebPreferences standardPreferences]; 80 preferences.get().mediaDataLoadsAutomatically = YES; 81 preferences.get().mediaPlaybackAllowsInline = YES; 82 preferences.get().mediaPlaybackRequiresUserGesture = NO; 83 75 84 RetainPtr<UIWindow> uiWindow = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 76 85 RetainPtr<UIWebView> uiWebView = adoptNS([[UIWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 77 86 [uiWindow addSubview:uiWebView.get()]; 78 87 79 uiWebView.get().mediaPlaybackRequiresUserAction = NO;80 uiWebView.get().allowsInlineMediaPlayback = YES;81 82 88 RetainPtr<ScrollingDoesNotPauseMediaDelegate> testController = adoptNS([ScrollingDoesNotPauseMediaDelegate new]); 83 89 uiWebView.get().delegate = testController.get(); 84 90 85 didFinishLoad = false; 86 gotMainFrame = false; 87 mainFrame = nil; 88 89 [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"video-with-audio" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 91 [uiWebView loadRequest:[NSURLRequest requestWithURL:[NSBundle.mainBundle URLForResource:@"one-video" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 90 92 91 93 Util::run(&didFinishLoad); … … 95 97 [mainFrame setTimeoutsPaused:YES]; 96 98 97 DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[ mainFrame.DOMDocumentquerySelector:@"video"];99 DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"]; 98 100 ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]); 99 101 102 [video addEventListener:@"canplaythrough" listener:testController.get() useCapture:NO]; 100 103 [video addEventListener:@"playing" listener:testController.get() useCapture:NO]; 101 didReceivePlaying = false;102 [video play];104 [video addEventListener:@"pause" listener:testController.get() useCapture:NO]; 105 [video setSrc:@"video-with-audio.mp4"]; 103 106 104 107 [mainFrame setTimeoutsPaused:NO]; 108 }); 109 110 Util::run(&readyToTest); 111 112 callOnMainThreadAndWait([&] () mutable { 113 DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"]; 114 ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]); 115 116 [video play]; 105 117 }); 106 118 … … 108 120 109 121 callOnMainThreadAndWait([&] () mutable { 110 [mainFrame setTimeoutsPaused:YES]; 111 112 DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[mainFrame.DOMDocument querySelector:@"video"]; 122 DOMHTMLMediaElement* video = (DOMHTMLMediaElement*)[[mainFrame DOMDocument] querySelector:@"video"]; 113 123 ASSERT_TRUE([video isKindOfClass:[DOMHTMLMediaElement class]]); 114 124 115 [video addEventListener:@"pause" listener:testController.get() useCapture:NO];116 didReceivePause = false;117 125 [video pause]; 118 119 [mainFrame setTimeoutsPaused:NO];120 126 }); 121 127
Note: See TracChangeset
for help on using the changeset viewer.