Changeset 211045 in webkit
- Timestamp:
- Jan 23, 2017, 11:23:34 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 22 edited
- 2 moved
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (modified) (2 diffs)
-
Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (modified) (4 diffs)
-
Source/WebKit2/ChangeLog (modified) (1 diff)
-
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (modified) (2 diffs)
-
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (modified) (2 diffs)
-
Source/WebKit2/UIProcess/PageClient.h (modified) (2 diffs)
-
Source/WebKit2/UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
Source/WebKit2/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (modified) (1 diff)
-
Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (modified) (2 diffs)
-
Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (modified) (2 diffs)
-
Source/WebKit2/WebProcess/WebPage/WebPage.h (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (modified) (1 diff)
-
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (modified) (2 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (5 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NowPlayingControlsTests.mm (modified) (7 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/SnapshotStore.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm (modified) (1 diff)
-
Tools/TestWebKitAPI/cocoa/TestWKWebView.h (moved) (moved from trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.h ) (3 diffs)
-
Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (moved) (moved from trunk/Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm ) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r211042 r211045 1 2017-01-23 Jer Noble <jer.noble@apple.com> 2 3 REGRESSION (r208149): Video details does not apear and missing scrubber in Control Center 4 https://bugs.webkit.org/show_bug.cgi?id=167233 5 6 Reviewed by Alex Christensen. 7 8 Test: In TestWebKitAPI, NowPlayingControlsTests.NowPlayingControlsIOS 9 10 In r208149, we introduced a new media type, Video, and renamed the old type to 11 VideoAudio (to be able to distinguish between video-with-audio and silent-video). 12 But we missed one place where that type needs to be renamed. 13 14 For testing purposes, overload methods from PlatformMediaSessionManager which WebKit2 uses 15 to report the current now playing session and it's information. 16 17 * platform/audio/ios/MediaSessionManagerIOS.h: 18 * platform/audio/ios/MediaSessionManagerIOS.mm: 19 (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession): 20 (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): 21 1 22 2017-01-23 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h
r200466 r211045 71 71 bool sessionCanLoadMedia(const PlatformMediaSession&) const override; 72 72 73 bool hasActiveNowPlayingSession() const final { return m_nowPlayingActive; } 74 String lastUpdatedNowPlayingTitle() const final { return m_reportedTitle; } 75 double lastUpdatedNowPlayingDuration() const final { return m_reportedDuration; } 76 double lastUpdatedNowPlayingElapsedTime() const final { return m_reportedCurrentTime; } 77 73 78 PlatformMediaSession* nowPlayingEligibleSession(); 74 79 … … 76 81 double m_reportedRate { 0 }; 77 82 double m_reportedDuration { 0 }; 83 double m_reportedCurrentTime { 0 }; 78 84 String m_reportedTitle; 79 85 bool m_nowPlayingActive { false }; -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r210104 r211045 220 220 return findSession([] (PlatformMediaSession& session, size_t) { 221 221 PlatformMediaSession::MediaType type = session.mediaType(); 222 if (type != PlatformMediaSession::Video && type != PlatformMediaSession::Audio)222 if (type != PlatformMediaSession::VideoAudio && type != PlatformMediaSession::Audio) 223 223 return false; 224 224 … … 250 250 double duration = currentSession->duration(); 251 251 double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0; 252 double currentTime = currentSession->currentTime(); 252 253 if (m_reportedTitle == title && m_reportedRate == rate && m_reportedDuration == duration) { 253 254 LOG(Media, "MediaSessionManageriOS::updateNowPlayingInfo - nothing new to show"); … … 258 259 m_reportedDuration = duration; 259 260 m_reportedTitle = title; 261 m_reportedCurrentTime = currentTime; 260 262 261 263 auto info = adoptNS([[NSMutableDictionary alloc] init]); … … 266 268 info.get()[MPNowPlayingInfoPropertyPlaybackRate] = @(rate); 267 269 268 double currentTime = currentSession->currentTime();269 270 if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime()) 270 271 info.get()[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(currentTime); -
trunk/Source/WebKit2/ChangeLog
r211042 r211045 1 2017-01-23 Jer Noble <jer.noble@apple.com> 2 3 Video details does not apear and missing scrubber in Control Center 4 https://bugs.webkit.org/show_bug.cgi?id=167233 5 6 Reviewed by Alex Christensen. 7 8 Make requestActiveNowPlayingSessionInfo() and handleActiveNowPlayingSessionInfoResponse() 9 work in PLATFORM(IOS). 10 11 * UIProcess/API/Cocoa/WKWebView.mm: 12 (-[WKWebView _requestActiveNowPlayingSessionInfo]): 13 (-[WKWebView _handleActiveNowPlayingSessionInfoResponse:title:duration:elapsedTime:]): 14 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 15 * UIProcess/PageClient.h: 16 * UIProcess/WebPageProxy.cpp: 17 (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): 18 (WebKit::WebPageProxy::handleActiveNowPlayingSessionInfoResponse): 19 * UIProcess/WebPageProxy.h: 20 * UIProcess/WebPageProxy.messages.in: 21 * UIProcess/ios/PageClientImplIOS.h: 22 * UIProcess/ios/PageClientImplIOS.mm: 23 (WebKit::PageClientImpl::handleActiveNowPlayingSessionInfoResponse): 24 * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: 25 (WebKit::WebPage::requestActiveNowPlayingSessionInfo): 26 * WebProcess/WebPage/WebPage.h: 27 * WebProcess/WebPage/WebPage.messages.in: 28 * WebProcess/WebPage/mac/WebPageMac.mm: 29 (WebKit::WebPage::requestActiveNowPlayingSessionInfo): Deleted. 30 1 31 2017-01-23 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r210913 r211045 4862 4862 } 4863 4863 4864 - (void)_insertText:(id)string replacementRange:(NSRange)replacementRange 4865 { 4866 [self insertText:string replacementRange:replacementRange]; 4867 } 4868 4869 - (void)_setHeaderBannerHeight:(int)height 4870 { 4871 _page->setHeaderBannerHeightForTesting(height); 4872 } 4873 4874 - (void)_setFooterBannerHeight:(int)height 4875 { 4876 _page->setFooterBannerHeightForTesting(height); 4877 } 4878 4879 #endif // PLATFORM(MAC) 4880 4864 4881 - (void)_requestActiveNowPlayingSessionInfo 4865 4882 { … … 4872 4889 // Overridden by subclasses. 4873 4890 } 4874 4875 - (void)_insertText:(id)string replacementRange:(NSRange)replacementRange4876 {4877 [self insertText:string replacementRange:replacementRange];4878 }4879 4880 - (void)_setHeaderBannerHeight:(int)height4881 {4882 _page->setHeaderBannerHeightForTesting(height);4883 }4884 4885 - (void)_setFooterBannerHeight:(int)height4886 {4887 _page->setFooterBannerHeightForTesting(height);4888 }4889 4890 #endif // PLATFORM(MAC)4891 4891 4892 4892 - (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r209975 r211045 309 309 - (void)_didUpdateCandidateListVisibility:(BOOL)visible WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 310 310 @property (nonatomic, readonly) BOOL _shouldRequestCandidates WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 311 - (void)_requestActiveNowPlayingSessionInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA));312 - (void)_handleActiveNowPlayingSessionInfoResponse:(BOOL)hasActiveSession title:(NSString *)title duration:(double)duration elapsedTime:(double)elapsedTime WK_API_AVAILABLE(macosx(WK_MAC_TBA));313 314 311 - (void)_insertText:(id)string replacementRange:(NSRange)replacementRange WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 315 312 … … 318 315 #endif 319 316 317 - (void)_requestActiveNowPlayingSessionInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 318 - (void)_handleActiveNowPlayingSessionInfoResponse:(BOOL)hasActiveSession title:(NSString *)title duration:(double)duration elapsedTime:(double)elapsedTime WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 319 320 320 - (void)_setPageScale:(CGFloat)scale withOrigin:(CGPoint)origin WK_API_AVAILABLE(ios(WK_IOS_TBA)); 321 321 - (CGFloat)_pageScale WK_API_AVAILABLE(ios(WK_IOS_TBA)); -
trunk/Source/WebKit2/UIProcess/PageClient.h
r210689 r211045 254 254 virtual void removeNavigationGestureSnapshot() = 0; 255 255 virtual void handleControlledElementIDResponse(const String&) = 0; 256 virtual void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) = 0;257 256 258 257 virtual CGRect boundsOfLayerInLayerBackedWindowCoordinates(CALayer *) const = 0; … … 284 283 virtual void setEditableElementIsFocused(bool) = 0; 285 284 #endif // PLATFORM(MAC) 285 286 #if PLATFORM(COCOA) 287 virtual void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) = 0; 288 #endif 286 289 287 290 #if PLATFORM(IOS) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r211007 r211045 6478 6478 } 6479 6479 6480 void WebPageProxy::requestActiveNowPlayingSessionInfo()6481 {6482 m_process->send(Messages::WebPage::RequestActiveNowPlayingSessionInfo(), m_pageID);6483 }6484 6485 void WebPageProxy::handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) const6486 {6487 m_pageClient.handleActiveNowPlayingSessionInfoResponse(hasActiveSession, title, duration, elapsedTime);6488 }6489 6490 6480 void WebPageProxy::handleControlledElementIDResponse(const String& identifier) const 6491 6481 { … … 6500 6490 return false; 6501 6491 #endif 6492 } 6493 #endif 6494 6495 #if PLATFORM(COCOA) 6496 void WebPageProxy::requestActiveNowPlayingSessionInfo() 6497 { 6498 m_process->send(Messages::WebPage::RequestActiveNowPlayingSessionInfo(), m_pageID); 6499 } 6500 6501 void WebPageProxy::handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) const 6502 { 6503 m_pageClient.handleActiveNowPlayingSessionInfoResponse(hasActiveSession, title, duration, elapsedTime); 6502 6504 } 6503 6505 #endif -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r211007 r211045 1065 1065 void requestControlledElementID() const; 1066 1066 void handleControlledElementIDResponse(const String&) const; 1067 bool isPlayingVideoInEnhancedFullscreen() const; 1068 #endif 1069 1070 #if PLATFORM(COCOA) 1067 1071 void requestActiveNowPlayingSessionInfo(); 1068 1072 void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) const; 1069 bool isPlayingVideoInEnhancedFullscreen() const;1070 1073 #endif 1071 1074 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r210753 r211045 484 484 #if PLATFORM(MAC) 485 485 DidHandleAcceptedCandidate() 486 #endif 487 488 #if PLATFORM(COCOA) 486 489 HandleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, String title, double duration, double elapsedTime) 487 490 #endif -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h
r210689 r211045 195 195 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; 196 196 197 void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) override; 198 197 199 WKContentView *m_contentView; 198 200 WKWebView *m_webView; -
trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm
r210689 r211045 35 35 #import "NativeWebKeyboardEvent.h" 36 36 #import "NavigationState.h" 37 #import "StringUtilities.h" 37 38 #import "UIKitSPI.h" 38 39 #import "ViewSnapshotStore.h" … … 750 751 } 751 752 753 void PageClientImpl::handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) 754 { 755 [m_webView _handleActiveNowPlayingSessionInfoResponse:hasActiveSession title:nsStringFromWebCoreString(title) duration:duration elapsedTime:elapsedTime]; 756 } 757 752 758 } // namespace WebKit 753 759 -
trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
r202889 r211045 28 28 29 29 #import "LoadParameters.h" 30 #import "WebPageProxyMessages.h" 31 #import <WebCore/PlatformMediaSessionManager.h> 30 32 31 33 #if PLATFORM(COCOA) … … 40 42 } 41 43 44 void WebPage::requestActiveNowPlayingSessionInfo() 45 { 46 bool hasActiveSession = false; 47 String title = emptyString(); 48 double duration = NAN; 49 double elapsedTime = NAN; 50 if (auto* sharedManager = WebCore::PlatformMediaSessionManager::sharedManagerIfExists()) { 51 hasActiveSession = sharedManager->hasActiveNowPlayingSession(); 52 title = sharedManager->lastUpdatedNowPlayingTitle(); 53 duration = sharedManager->lastUpdatedNowPlayingDuration(); 54 elapsedTime = sharedManager->lastUpdatedNowPlayingElapsedTime(); 55 } 56 57 send(Messages::WebPageProxy::HandleActiveNowPlayingSessionInfoResponse(hasActiveSession, title, duration, elapsedTime)); 58 } 59 42 60 } // namespace WebKit 43 61 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r211007 r211045 1225 1225 1226 1226 void handleAcceptedCandidate(WebCore::TextCheckingResult); 1227 #endif 1228 1229 #if PLATFORM(COCOA) 1227 1230 void requestActiveNowPlayingSessionInfo(); 1228 1231 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r211007 r211045 425 425 426 426 HandleAcceptedCandidate(struct WebCore::TextCheckingResult acceptedCandidate) 427 RequestActiveNowPlayingSessionInfo()428 427 429 428 SetHeaderBannerHeightForTesting(int height); 430 429 SetFooterBannerHeightForTesting(int height); 430 #endif 431 432 #if PLATFORM(COCOA) 433 RequestActiveNowPlayingSessionInfo() 431 434 #endif 432 435 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r210845 r211045 77 77 #import <WebCore/PageOverlayController.h> 78 78 #import <WebCore/PlatformKeyboardEvent.h> 79 #import <WebCore/PlatformMediaSessionManager.h>80 79 #import <WebCore/PluginDocument.h> 81 80 #import <WebCore/RenderElement.h> … … 161 160 frame->editor().handleAcceptedCandidate(acceptedCandidate); 162 161 send(Messages::WebPageProxy::DidHandleAcceptedCandidate()); 163 }164 165 void WebPage::requestActiveNowPlayingSessionInfo()166 {167 bool hasActiveSession = false;168 String title = emptyString();169 double duration = NAN;170 double elapsedTime = NAN;171 if (auto* sharedManager = WebCore::PlatformMediaSessionManager::sharedManagerIfExists()) {172 hasActiveSession = sharedManager->hasActiveNowPlayingSession();173 title = sharedManager->lastUpdatedNowPlayingTitle();174 duration = sharedManager->lastUpdatedNowPlayingDuration();175 elapsedTime = sharedManager->lastUpdatedNowPlayingElapsedTime();176 }177 178 send(Messages::WebPageProxy::HandleActiveNowPlayingSessionInfoResponse(hasActiveSession, title, duration, elapsedTime));179 162 } 180 163 -
trunk/Tools/ChangeLog
r211015 r211045 1 2017-01-23 Jer Noble <jer.noble@apple.com> 2 3 Video details does not apear and missing scrubber in Control Center 4 https://bugs.webkit.org/show_bug.cgi?id=167233 5 6 Reviewed by Alex Christensen. 7 8 Refactor TestWKWebViewMac to work on PLATFORM(IOS). Add a new test to 9 NowPlayingControlTests for iOS. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 * TestWebKitAPI/Tests/WebKit2Cocoa/NowPlayingControlsTests.mm: 13 (-[NowPlayingTestWebView setWindowVisible:]): 14 (TestWebKitAPI::TEST): 15 * TestWebKitAPI/Tests/WebKit2Cocoa/SnapshotStore.mm: 16 * TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm: 17 * TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm: 18 * TestWebKitAPI/cocoa/TestWKWebView.h: Renamed from Tools/TestWebKitAPI/mac/TestWKWebViewMac.h. 19 * TestWebKitAPI/cocoa/TestWKWebView.mm: Renamed from Tools/TestWebKitAPI/mac/TestWKWebViewMac.mm. 20 (SOFT_LINK_CLASS): 21 (-[TestMessageHandler addMessage:withHandler:]): 22 (-[TestMessageHandler userContentController:didReceiveScriptMessage:]): 23 (__simulated_forceClickAssociatedEventsMask): 24 (-[TestWKWebViewHostWindow _mouseDownAtPoint:simulatePressure:]): 25 (-[TestWKWebViewHostWindow isKeyWindow]): 26 (-[TestWKWebViewHostWindow makeKeyWindow]): 27 (-[TestWKWebViewHostWindow resignKeyWindow]): 28 (-[TestWKWebView initWithFrame:]): 29 (-[TestWKWebView initWithFrame:configuration:]): 30 (-[TestWKWebView _setUpTestWindow:]): 31 (-[TestWKWebView performAfterReceivingMessage:action:]): 32 (-[TestWKWebView loadTestPageNamed:]): 33 (-[TestWKWebView synchronouslyLoadTestPageNamed:]): 34 (-[TestWKWebView stringByEvaluatingJavaScript:]): 35 (-[TestWKWebView waitForMessage:]): 36 (-[TestWKWebView performAfterLoading:]): 37 (-[TestWKWebView mouseDownAtPoint:simulatePressure:]): 38 (-[TestWKWebView typeCharacter:]): 39 1 40 2017-01-21 Carlos Garcia Campos <cgarcia@igalia.com> 2 41 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r210790 r211045 87 87 2EFF06C71D886A580004BB30 /* change-video-source-on-end.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */; }; 88 88 2EFF06CD1D8A429A0004BB30 /* input-field-in-scrollable-document.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */; }; 89 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView Mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */; };89 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */; }; 90 90 2EFF06D71D8AF34A0004BB30 /* WKWebViewCandidateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */; }; 91 91 315118101DB1AE4000176304 /* ExtendedColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3151180F1DB1ADD500176304 /* ExtendedColor.cpp */; }; … … 881 881 2EFF06C61D886A560004BB30 /* change-video-source-on-end.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "change-video-source-on-end.html"; sourceTree = "<group>"; }; 882 882 2EFF06CC1D8A42910004BB30 /* input-field-in-scrollable-document.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "input-field-in-scrollable-document.html"; sourceTree = "<group>"; }; 883 2EFF06D21D8AEDBB0004BB30 /* TestWKWebView Mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewMac.h; sourceTree = "<group>"; };884 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView Mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestWKWebViewMac.mm; sourceTree = "<group>"; };883 2EFF06D21D8AEDBB0004BB30 /* TestWKWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestWKWebView.h; path = cocoa/TestWKWebView.h; sourceTree = "<group>"; }; 884 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestWKWebView.mm; path = cocoa/TestWKWebView.mm; sourceTree = "<group>"; }; 885 885 2EFF06D61D8AF34A0004BB30 /* WKWebViewCandidateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewCandidateTests.mm; sourceTree = "<group>"; }; 886 886 3151180F1DB1ADD500176304 /* ExtendedColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtendedColor.cpp; sourceTree = "<group>"; }; … … 1435 1435 A14FC58D1B8AE36500D107EB /* TestProtocol.h */, 1436 1436 A14FC58E1B8AE36500D107EB /* TestProtocol.mm */, 1437 2EFF06D21D8AEDBB0004BB30 /* TestWKWebView.h */, 1438 2EFF06D31D8AEDBB0004BB30 /* TestWKWebView.mm */, 1437 1439 7C83E0391D0A602700FEBCF3 /* UtilitiesCocoa.mm */, 1438 1440 A14FC5841B89739100D107EB /* WKWebViewConfigurationExtras.h */, … … 2010 2012 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */, 2011 2013 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */, 2012 2EFF06D21D8AEDBB0004BB30 /* TestWKWebViewMac.h */,2013 2EFF06D31D8AEDBB0004BB30 /* TestWKWebViewMac.mm */,2014 2014 C08587BE13FE956C001EF4E5 /* WebKitAgnosticTest.h */, 2015 2015 C08587BD13FE956C001EF4E5 /* WebKitAgnosticTest.mm */, … … 2568 2568 7CCE7EFC1A411AE600447C4C /* InjectedBundleFrameHitTest.cpp in Sources */, 2569 2569 7CCE7EFD1A411AE600447C4C /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */, 2570 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView Mac.mm in Sources */,2570 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */, 2571 2571 7C83E0B81D0A64BD00FEBCF3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */, 2572 2572 7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NowPlayingControlsTests.mm
r207220 r211045 27 27 28 28 #import "PlatformUtilities.h" 29 #import "TestWKWebView Mac.h"29 #import "TestWKWebView.h" 30 30 31 31 #import <WebKit/WKWebViewConfigurationPrivate.h> 32 32 #import <WebKit/WKWebViewPrivate.h> 33 33 34 #if WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 10120134 #if WK_API_ENABLED && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201) 35 35 36 36 @interface NowPlayingTestWebView : TestWKWebView … … 94 94 _receivedNowPlayingInfoResponse = true; 95 95 } 96 97 - (void)setWindowVisible:(BOOL)isVisible 98 { 99 #if PLATFORM(MAC) 100 [self.window setIsVisible:isVisible]; 101 #else 102 self.window.hidden = !isVisible; 103 #endif 104 } 96 105 @end 97 106 98 107 namespace TestWebKitAPI { 99 108 109 #if PLATFORM(MAC) 100 110 TEST(NowPlayingControlsTests, NowPlayingControlsDoNotShowForForegroundPage) 101 111 { … … 106 116 [webView waitForMessage:@"playing"]; 107 117 108 [webView .window setIsVisible:YES];118 [webView setWindowVisible:YES]; 109 119 [webView.window makeKeyWindow]; 110 120 [webView expectHasActiveNowPlayingSession:NO]; … … 123 133 [webView waitForMessage:@"playing"]; 124 134 125 [webView .window setIsVisible:NO];135 [webView setWindowVisible:NO]; 126 136 [webView.window resignKeyWindow]; 127 137 [webView expectHasActiveNowPlayingSession:YES]; … … 140 150 [webView waitForMessage:@"playing"]; 141 151 142 [webView .window setIsVisible:NO];152 [webView setWindowVisible:NO]; 143 153 [webView.window resignKeyWindow]; 144 154 145 155 [webView expectHasActiveNowPlayingSession:YES]; 146 156 147 [webView .window setIsVisible:YES];157 [webView setWindowVisible:YES]; 148 158 [webView.window makeKeyWindow]; 149 159 … … 163 173 [webView waitForMessage:@"playing"]; 164 174 165 [webView mouseDownAtPoint:NSMakePoint(240, 160) simulatePressure:YES];166 [webView .window setIsVisible:NO];175 [webView stringByEvaluatingJavaScript:@"document.querySelector('video').muted = true"]; 176 [webView setWindowVisible:NO]; 167 177 [webView.window resignKeyWindow]; 168 178 … … 173 183 ASSERT_TRUE(isnan(webView.lastUpdatedElapsedTime)); 174 184 } 185 #endif // PLATFORM(MAC) 186 187 #if PLATFORM(IOS) 188 TEST(NowPlayingControlsTests, NowPlayingControlsIOS) 189 { 190 WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; 191 configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; 192 NowPlayingTestWebView *webView = [[NowPlayingTestWebView alloc] initWithFrame:NSMakeRect(0, 0, 480, 320) configuration:configuration]; 193 [webView loadTestPageNamed:@"large-video-test-now-playing"]; 194 [webView waitForMessage:@"playing"]; 195 196 [webView expectHasActiveNowPlayingSession:YES]; 197 ASSERT_STREQ("foo", webView.lastUpdatedTitle.UTF8String); 198 ASSERT_EQ(10, webView.lastUpdatedDuration); 199 ASSERT_GE(webView.lastUpdatedElapsedTime, 0); 200 } 201 #endif 175 202 176 203 } // namespace TestWebKitAPI 177 204 178 #endif // WK_API_ENABLED && PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201205 #endif // WK_API_ENABLED && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201) -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/SnapshotStore.mm
r206833 r211045 32 32 #import "Test.h" 33 33 #import "TestNavigationDelegate.h" 34 #import "TestWKWebView Mac.h"34 #import "TestWKWebView.h" 35 35 #import <WebKit/WKBackForwardListItemPrivate.h> 36 36 #import <WebKit/WKPage.h> -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/VideoControlsManager.mm
r208655 r211045 27 27 28 28 #import "PlatformUtilities.h" 29 #import "TestWKWebView Mac.h"29 #import "TestWKWebView.h" 30 30 31 31 #import <WebKit/WKWebViewConfigurationPrivate.h> -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewCandidateTests.mm
r206335 r211045 29 29 30 30 #import "PlatformUtilities.h" 31 #import "TestWKWebView Mac.h"31 #import "TestWKWebView.h" 32 32 33 33 #import <Carbon/Carbon.h> -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h
r211044 r211045 24 24 */ 25 25 26 #ifndef TestWKWebViewMac_h27 #define TestWKWebViewMac_h28 29 26 #import <WebKit/WebKit.h> 30 27 31 #if WK_API_ENABLED && PLATFORM(MAC)28 #if WK_API_ENABLED 32 29 33 30 @interface TestMessageHandler : NSObject <WKScriptMessageHandler> … … 36 33 37 34 @interface TestWKWebView : WKWebView 38 // Simulates clicking with a pressure-sensitive device, if possible.39 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure;40 35 - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action; 41 36 - (void)loadTestPageNamed:(NSString *)pageName; 42 37 - (void)synchronouslyLoadTestPageNamed:(NSString *)pageName; 43 - (void)typeCharacter:(char)character;44 38 - (NSString *)stringByEvaluatingJavaScript:(NSString *)script; 45 39 - (void)waitForMessage:(NSString *)message; … … 47 41 @end 48 42 49 #endif /* WK_API_ENABLED && PLATFORM(MAC) */ 43 #if PLATFORM(MAC) 44 @interface TestWKWebView (MacOnly) 45 // Simulates clicking with a pressure-sensitive device, if possible. 46 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure; 47 - (void)typeCharacter:(char)character; 48 @end 49 #endif 50 50 51 #endif /* TestWKWebViewMac_h */ 51 #endif // WK_API_ENABLED 52 -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r211044 r211045 25 25 26 26 #import "config.h" 27 #import "TestWKWebView Mac.h"28 29 #if WK_API_ENABLED && PLATFORM(MAC)27 #import "TestWKWebView.h" 28 29 #if WK_API_ENABLED 30 30 31 31 #import "TestNavigationDelegate.h" 32 32 #import "Utilities.h" 33 33 34 #import <AppKit/AppKit.h>35 #import <Carbon/Carbon.h>36 34 #import <WebKit/WebKitPrivate.h> 37 35 #import <objc/runtime.h> 38 36 #import <wtf/RetainPtr.h> 37 38 #if PLATFORM(MAC) 39 #import <AppKit/AppKit.h> 40 #import <Carbon/Carbon.h> 39 41 #import <wtf/mac/AppKitCompatibilityDeclarations.h> 42 #endif 43 44 #if PLATFORM(IOS) 45 #import <WebCore/SoftLinking.h> 46 SOFT_LINK_FRAMEWORK(UIKit) 47 SOFT_LINK_CLASS(UIKit, UIWindow) 48 #endif 40 49 41 50 @implementation TestMessageHandler { … … 60 69 @end 61 70 71 #if PLATFORM(MAC) 62 72 @interface TestWKWebViewHostWindow : NSWindow 73 #else 74 @interface TestWKWebViewHostWindow : UIWindow 75 #endif // PLATFORM(MAC) 63 76 @end 64 77 … … 67 80 } 68 81 82 #if PLATFORM(MAC) 69 83 static int gEventNumber = 1; 70 84 … … 107 121 #endif 108 122 } 123 #endif // PLATFORM(MAC) 109 124 110 125 - (BOOL)isKeyWindow … … 119 134 120 135 _forceKeyWindow = YES; 136 #if PLATFORM(MAC) 121 137 [[NSNotificationCenter defaultCenter] postNotificationName:NSWindowDidBecomeKeyNotification object:self]; 138 #else 139 [[NSNotificationCenter defaultCenter] postNotificationName:UIWindowDidBecomeKeyNotification object:self]; 140 #endif 122 141 } 123 142 … … 151 170 - (void)_setUpTestWindow:(NSRect)frame 152 171 { 172 #if PLATFORM(MAC) 153 173 _hostWindow = [[TestWKWebViewHostWindow alloc] initWithContentRect:frame styleMask:NSWindowStyleMaskBorderless backing:NSBackingStoreBuffered defer:NO]; 154 174 [_hostWindow setFrameOrigin:NSMakePoint(0, 0)]; 175 [_hostWindow setIsVisible:YES]; 155 176 [[_hostWindow contentView] addSubview:self]; 156 [_hostWindow setIsVisible:YES];157 177 [_hostWindow makeKeyAndOrderFront:self]; 158 } 159 160 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure 161 { 162 [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure]; 178 #else 179 _hostWindow = [[TestWKWebViewHostWindow alloc] initWithFrame:frame]; 180 _hostWindow.hidden = NO; 181 [_hostWindow addSubview:self]; 182 #endif 163 183 } 164 184 … … 183 203 [self loadTestPageNamed:pageName]; 184 204 [self _test_waitForDidFinishNavigation]; 185 }186 187 - (void)typeCharacter:(char)character {188 NSString *characterAsString = [NSString stringWithFormat:@"%c" , character];189 NSEventType keyDownEventType = NSEventTypeKeyDown;190 NSEventType keyUpEventType = NSEventTypeKeyUp;191 [self keyDown:[NSEvent keyEventWithType:keyDownEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];192 [self keyUp:[NSEvent keyEventWithType:keyUpEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]];193 205 } 194 206 … … 232 244 @end 233 245 234 #endif /* WK_API_ENABLED && PLATFORM(MAC) */ 246 #if PLATFORM(MAC) 247 @implementation TestWKWebView (MacOnly) 248 - (void)mouseDownAtPoint:(NSPoint)point simulatePressure:(BOOL)simulatePressure 249 { 250 [_hostWindow _mouseDownAtPoint:point simulatePressure:simulatePressure]; 251 } 252 253 - (void)typeCharacter:(char)character { 254 NSString *characterAsString = [NSString stringWithFormat:@"%c" , character]; 255 NSEventType keyDownEventType = NSEventTypeKeyDown; 256 NSEventType keyUpEventType = NSEventTypeKeyUp; 257 [self keyDown:[NSEvent keyEventWithType:keyDownEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]]; 258 [self keyUp:[NSEvent keyEventWithType:keyUpEventType location:NSZeroPoint modifierFlags:0 timestamp:GetCurrentEventTime() windowNumber:_hostWindow.windowNumber context:nil characters:characterAsString charactersIgnoringModifiers:characterAsString isARepeat:NO keyCode:character]]; 259 } 260 @end 261 #endif 262 263 #endif // WK_API_ENABLED
Note:
See TracChangeset
for help on using the changeset viewer.