WebKit Bugzilla
Attachment 340504 Details for
Bug 185680
: Improve NowPlaying "title"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185680-20180516112026.patch (text/plain), 25.80 KB, created by
Eric Carlson
on 2018-05-16 11:20:27 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2018-05-16 11:20:27 PDT
Size:
25.80 KB
patch
obsolete
>Subversion Revision: 231843 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2af26a5e76a0228b39de4d08a3cded519e14d811..b9d53bd63ebf5dc4f0cd6c596ea21f351163d3b8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2018-05-16 Eric Carlson <eric.carlson@apple.com> >+ >+ Improve NowPlaying "title" >+ https://bugs.webkit.org/show_bug.cgi?id=185680 >+ <rdar://problem/40296700> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We send NowPlaying the element's title attribute if not empty, else the element's current url. >+ Title should be preferred because it is the most specific, but we should use the document >+ title if non-empty next, and if falling back to the element's url use just the domain instead >+ of the full url because it isn't likely to be useful to the user given the small amount of >+ space control center uses to display the title. Further, don't use any title at all when >+ in private browsing mode. >+ >+ Tests: http/tests/media/now-playing-info-private-browsing.html >+ http/tests/media/now-playing-info.html >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::parseAttribute): Update NowPlaying when the title attribute changes. >+ (WebCore::HTMLMediaElement::finishSeek): Update NowPlaying when a seek completes. >+ (WebCore::HTMLMediaElement::mediaSessionTitle const): Update logic. >+ (WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Use the hash of the current >+ url as the unique identifier. >+ * html/HTMLMediaElement.h: >+ >+ * platform/audio/PlatformMediaSession.cpp: >+ (WebCore::PlatformMediaSession::uniqueIdentifier const): New. >+ (WebCore::PlatformMediaSessionClient::mediaSessionUniqueIdentifier const): Ditto. >+ * platform/audio/PlatformMediaSession.h: >+ >+ * platform/audio/ios/MediaSessionManagerIOS.mm: >+ (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Update m_lastUpdatedNowPlayingInfoUniqueIdentifier. >+ >+ * platform/audio/mac/MediaSessionManagerMac.mm: >+ (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Update. >+ >+ * testing/Internals.cpp: >+ (WebCore::Internals::nowPlayingState const): Expose NowPlaying state. >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2018-05-16 Antoine Quint <graouts@apple.com> > > REGRESSION (r230574): Interrupted hardware transitions don't behave correctly >diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp >index a6e0ab6a56ec75ac76d4c21fa4c710176a2d27ad..6c6ee240fafa673021a273b4afcca8917bb9eff7 100644 >--- a/Source/WebCore/html/HTMLMediaElement.cpp >+++ b/Source/WebCore/html/HTMLMediaElement.cpp >@@ -878,6 +878,9 @@ void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomicStr > else if (name == autoplayAttr) { > if (processingUserGestureForMedia()) > removeBehaviorsRestrictionsAfterFirstUserGesture(); >+ } else if (name == titleAttr) { >+ if (m_mediaSession) >+ m_mediaSession->clientCharacteristicsChanged(); > } > else > HTMLElement::parseAttribute(name, value); >@@ -3081,6 +3084,9 @@ void HTMLMediaElement::finishSeek() > // 17 - Queue a task to fire a simple event named seeked at the element. > scheduleEvent(eventNames().seekedEvent); > >+ if (m_mediaSession) >+ m_mediaSession->clientCharacteristicsChanged(); >+ > #if ENABLE(MEDIA_SOURCE) > if (m_mediaSource) > m_mediaSource->monitorSourceBuffers(); >@@ -7443,10 +7449,26 @@ void HTMLMediaElement::mayResumePlayback(bool shouldResume) > > String HTMLMediaElement::mediaSessionTitle() const > { >- if (hasAttributeWithoutSynchronization(titleAttr)) >- return attributeWithoutSynchronization(titleAttr); >+ if (!document().page() || document().page()->usesEphemeralSession()) >+ return emptyString(); >+ >+ if (hasAttributeWithoutSynchronization(titleAttr)) { >+ auto title = attributeWithoutSynchronization(titleAttr); >+ if (!title.isEmpty()) >+ return title; >+ } >+ >+ auto title = document().title(); >+ if (!title.isEmpty()) >+ return title; > >- return m_currentSrc; >+ return m_currentSrc.host(); >+} >+ >+uint64_t HTMLMediaElement::mediaSessionUniqueIdentifier() const >+{ >+ auto& url = m_currentSrc.string(); >+ return url.impl() ? url.impl()->hash() : 0; > } > > void HTMLMediaElement::didReceiveRemoteControlCommand(PlatformMediaSession::RemoteControlCommandType command, const PlatformMediaSession::RemoteCommandArgument* argument) >diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h >index c8b94b5e1a671a1bdfac8e4bab469ba62ade6138..42109a3430b0953f21b143818872be598917fb89 100644 >--- a/Source/WebCore/html/HTMLMediaElement.h >+++ b/Source/WebCore/html/HTMLMediaElement.h >@@ -860,6 +860,7 @@ private: > void suspendPlayback() override; > void resumeAutoplaying() override; > void mayResumePlayback(bool shouldResume) override; >+ uint64_t mediaSessionUniqueIdentifier() const final; > String mediaSessionTitle() const override; > double mediaSessionDuration() const override { return duration(); } > double mediaSessionCurrentTime() const override { return currentTime(); } >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.cpp b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >index 1de86e50aea19eb5368cf8f1e019329537082228..d56e7bdab167b2e19210971c21422a67f7a4ac07 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.cpp >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.cpp >@@ -238,6 +238,11 @@ PlatformMediaSession::CharacteristicsFlags PlatformMediaSession::characteristics > } > > #if ENABLE(VIDEO) >+uint64_t PlatformMediaSession::uniqueIdentifier() const >+{ >+ return m_client.mediaSessionUniqueIdentifier(); >+} >+ > String PlatformMediaSession::title() const > { > return m_client.mediaSessionTitle(); >@@ -323,6 +328,11 @@ void PlatformMediaSession::canProduceAudioChanged() > } > > #if ENABLE(VIDEO) >+uint64_t PlatformMediaSessionClient::mediaSessionUniqueIdentifier() const >+{ >+ return 0; >+} >+ > String PlatformMediaSessionClient::mediaSessionTitle() const > { > return String(); >diff --git a/Source/WebCore/platform/audio/PlatformMediaSession.h b/Source/WebCore/platform/audio/PlatformMediaSession.h >index 037ff04dfa4126f5309008a4dc9ae3d8254779c1..721c7fa85b56440da29c2226f6b2c8edd8abf8da 100644 >--- a/Source/WebCore/platform/audio/PlatformMediaSession.h >+++ b/Source/WebCore/platform/audio/PlatformMediaSession.h >@@ -113,6 +113,7 @@ public: > void stopSession(); > > #if ENABLE(VIDEO) >+ uint64_t uniqueIdentifier() const; > String title() const; > double duration() const; > double currentTime() const; >@@ -216,6 +217,7 @@ public: > virtual void suspendPlayback() = 0; > > #if ENABLE(VIDEO) >+ virtual uint64_t mediaSessionUniqueIdentifier() const; > virtual String mediaSessionTitle() const; > virtual double mediaSessionDuration() const; > virtual double mediaSessionCurrentTime() const; >diff --git a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >index 8b0bb34eb62bdf95e8af648b1d2a75ff1dcbc7ca..b1df2a9842bf846b4caad7fb16cea772b9e0bb6c 100644 >--- a/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >+++ b/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm >@@ -280,6 +280,7 @@ void MediaSessionManageriOS::updateNowPlayingInfo() > m_reportedDuration = duration; > m_reportedTitle = title; > m_reportedCurrentTime = currentTime; >+ m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); > > auto info = adoptNS([[NSMutableDictionary alloc] init]); > if (!title.isEmpty()) >diff --git a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >index 106f95a8b94d9f344242d0eb30fe5ed815cca103..67af08b63cadac8694e88eb28ca6c8753c5dab4c 100644 >--- a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >+++ b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm >@@ -176,7 +176,7 @@ void MediaSessionManagerMac::updateNowPlayingInfo() > auto cfRate = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &rate)); > CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoPlaybackRate, cfRate.get()); > >- m_lastUpdatedNowPlayingInfoUniqueIdentifier = title.impl() ? title.impl()->hash() : 0; >+ m_lastUpdatedNowPlayingInfoUniqueIdentifier = currentSession->uniqueIdentifier(); > auto cfIdentifier = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberLongLongType, &m_lastUpdatedNowPlayingInfoUniqueIdentifier)); > CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoUniqueIdentifier, cfIdentifier.get()); > >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 507349d4c1702996ee54d3dacde7c0192c446c48..f0b8c55aaf25c6f0b5a27ca1732e71fe1ba3568b 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -3692,6 +3692,21 @@ void Internals::simulateSystemWake() const > #endif > } > >+ExceptionOr<Internals::NowPlayingState> Internals::nowPlayingState() const >+{ >+#if ENABLE(VIDEO) >+ return { { PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingTitle(), >+ PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingDuration(), >+ PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingElapsedTime(), >+ PlatformMediaSessionManager::sharedManager().lastUpdatedNowPlayingInfoUniqueIdentifier(), >+ PlatformMediaSessionManager::sharedManager().hasActiveNowPlayingSession(), >+ PlatformMediaSessionManager::sharedManager().registeredAsNowPlayingApplication() >+ } }; >+#else >+ return Exception { InvalidAccessError }; >+#endif >+} >+ > #if ENABLE(WIRELESS_PLAYBACK_TARGET) > > void Internals::setMockMediaPlaybackTargetPickerEnabled(bool enabled) >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 56fbd4a17e27bcbbc2984f21f5eacedae47a6937..8ac4dd7b15609f6940bd38f6858d3dd66db560b3 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -670,6 +670,16 @@ public: > > bool usingAppleInternalSDK() const; > >+ struct NowPlayingState { >+ String title; >+ double duration; >+ double elapsedTime; >+ uint64_t uniqueIdentifier; >+ bool hasActiveSession; >+ bool registeredAsNowPlayingApplication; >+ }; >+ ExceptionOr<NowPlayingState> nowPlayingState() const; >+ > private: > explicit Internals(Document&); > Document* contextDocument() const; >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 0c562d42052ad6732688597a131c820bc0920e31..35b2f2822daea30b419943d0151a2631656bd180 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -82,6 +82,19 @@ enum EventThrottlingBehavior { > "unresponsive" > }; > >+[ >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ Conditional=VIDEO, >+ JSGenerateToJSObject, >+] dictionary NowPlayingState { >+ boolean hasActiveSession; >+ boolean registeredAsNowPlayingApplication; >+ DOMString title; >+ unrestricted double duration; >+ unrestricted double elapsedTime; >+ unsigned long long uniqueIdentifier; >+}; >+ > [ > ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, > NoInterfaceObject, >@@ -601,4 +614,6 @@ enum EventThrottlingBehavior { > DOMString extraZoomModeAdaptationName(); > > boolean usingAppleInternalSDK(); >+ >+ [Conditional=VIDEO, MayThrowException] readonly attribute NowPlayingState nowPlayingState; > }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 56bc28486b6936388ac11a9b2c0868978fb10126..1add2a6389ff6e3bd70bde2f0933fb6915ecd781 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-16 Eric Carlson <eric.carlson@apple.com> >+ >+ Improve NowPlaying "title" >+ https://bugs.webkit.org/show_bug.cgi?id=185680 >+ <rdar://problem/40296700> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/media/now-playing-info-expected.txt: Added. >+ * http/tests/media/now-playing-info-private-browsing-expected.txt: Added. >+ * http/tests/media/now-playing-info-private-browsing.html: Added. >+ * http/tests/media/now-playing-info.html: Added. >+ * platform/gtk/TestExpectations: >+ > 2018-05-16 Antoine Quint <graouts@apple.com> > > REGRESSION (r230574): Interrupted hardware transitions don't behave correctly >diff --git a/LayoutTests/http/tests/media/now-playing-info-expected.txt b/LayoutTests/http/tests/media/now-playing-info-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..5c85b1d49ce747e8aa97b8305becebdf61a72890 >--- /dev/null >+++ b/LayoutTests/http/tests/media/now-playing-info-expected.txt >@@ -0,0 +1,45 @@ >+ >+Tests that the NowPlaying information is updated correctly as attributes change. >+ >+* NowPlaying should not be active before playback has started. >+RUN(video.src = findMediaFile("video", "resources/test")) >+EVENT(canplaythrough) >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'false') OK >+ >+* Start to play, NowPlaying should become active. >+RUN(video.play()) >+EVENT(playing) >+RUN(video.pause()) >+ >+* Title should be page title because video has no title. >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'true') OK >+EXPECTED (nowPlayingState.title == 'Page Title') OK >+EXPECTED (nowPlayingState.duration > '0') OK >+EXPECTED (nowPlayingState.elapsedTime >= '0') OK >+ >+* Set video title, it should be used. >+RUN(video.title = "Video Title") >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'true') OK >+EXPECTED (nowPlayingState.title == 'Video Title') OK >+EXPECTED (nowPlayingState.duration > '0') OK >+ >+* Clear video and page titles, page domain should be used. >+RUN(video.title = "") >+RUN(document.title = "") >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'true') OK >+EXPECTED (nowPlayingState.title == '127.0.0.1') OK >+EXPECTED (nowPlayingState.duration > '0') OK >+ >+* Change currentTime, state should be updated. >+RUN(video.currentTime = video.currentTime + 0.5) >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'true') OK >+EXPECTED (nowPlayingState.title == '127.0.0.1') OK >+EXPECTED (nowPlayingState.duration > '0') OK >+ >+END OF TEST >+ >diff --git a/LayoutTests/http/tests/media/now-playing-info-private-browsing-expected.txt b/LayoutTests/http/tests/media/now-playing-info-private-browsing-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..76551b902c19370c0a6cf57953d302dd4cbbe14b >--- /dev/null >+++ b/LayoutTests/http/tests/media/now-playing-info-private-browsing-expected.txt >@@ -0,0 +1,23 @@ >+ >+Tests that the NowPlaying title is not set when in private browsing mode. >+ >+* NowPlaying should not be active before playback has started. >+RUN(video.src = findMediaFile("video", "resources/test")) >+EVENT(canplaythrough) >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'false') OK >+ >+* Start to play, NowPlaying should become active. >+RUN(video.play()) >+EVENT(playing) >+RUN(video.pause()) >+ >+* Title should be blank because video has no title. >+RUN(nowPlayingState = internals.nowPlayingState) >+EXPECTED (nowPlayingState.registeredAsNowPlayingApplication == 'true') OK >+EXPECTED (nowPlayingState.title == '') OK >+EXPECTED (nowPlayingState.duration > '0') OK >+EXPECTED (nowPlayingState.elapsedTime >= '0') OK >+ >+END OF TEST >+ >diff --git a/LayoutTests/http/tests/media/now-playing-info-private-browsing.html b/LayoutTests/http/tests/media/now-playing-info-private-browsing.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c0a39917199a7157a136239ce18ce27fbe486e34 >--- /dev/null >+++ b/LayoutTests/http/tests/media/now-playing-info-private-browsing.html >@@ -0,0 +1,66 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <title>Page Title</title> >+ <script src=../../media-resources/video-test.js></script> >+ <script src=../../media-resources/media-file.js></script> >+ <script> >+ >+ let nowPlayingState; >+ let previousNowPlayingState; >+ >+ if (window.testRunner) >+ testRunner.setPrivateBrowsingEnabled(true); >+ >+ async function waitForAttributeToChange(attribute, expected) { >+ let start = new Date().getTime(); >+ do { >+ >+ if (internals.nowPlayingState[attribute] != expected) >+ return; >+ >+ await new Promise(resolve => setTimeout(resolve, 100)); >+ } while (new Date().getTime() - start < 500); >+ >+ failTest(`** Timed out waiting for "${attribute}" to change from "${expected}"`); >+ } >+ >+ async function runTest() >+ { >+ findMediaElement(); >+ >+ consoleWrite('<br>* NowPlaying should not be active before playback has started.'); >+ run('video.src = findMediaFile("video", "resources/test")'); >+ await waitFor(video, 'canplaythrough'); >+ >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', false); >+ >+ consoleWrite('<br>* Start to play, NowPlaying should become active.'); >+ runWithKeyDown(() => { >+ run('video.play()'); >+ }); >+ >+ await waitFor(video, 'playing'); >+ run('video.pause()'); >+ await waitForAttributeToChange('registeredAsNowPlayingApplication', false); >+ >+ consoleWrite('<br>* Title should be blank because video has no title.'); >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', true); >+ testExpected('nowPlayingState.title', ''); >+ testExpected('nowPlayingState.duration', '0', '>'); >+ testExpected('nowPlayingState.elapsedTime', '0', '>='); >+ previousNowPlayingState = nowPlayingState; >+ >+ consoleWrite(''); >+ endTest(); >+ } >+ </script> >+ </head> >+ <body onload="runTest()"> >+ <video controls title="Video Title"></video> >+ <br> >+ Tests that the NowPlaying title is not set when in private browsing mode. >+ </body> >+</html> >diff --git a/LayoutTests/http/tests/media/now-playing-info.html b/LayoutTests/http/tests/media/now-playing-info.html >new file mode 100644 >index 0000000000000000000000000000000000000000..b60220eba61d7fca7da73ae5ed4654310c859c0e >--- /dev/null >+++ b/LayoutTests/http/tests/media/now-playing-info.html >@@ -0,0 +1,109 @@ >+<!DOCTYPE html> >+<html> >+ <head> >+ <title>Page Title</title> >+ <script src=../../media-resources/video-test.js></script> >+ <script src=../../media-resources/media-file.js></script> >+ <script> >+ >+ let nowPlayingState; >+ let previousNowPlayingState; >+ >+ async function waitForAttributeToChange(attribute, expected) { >+ let start = new Date().getTime(); >+ do { >+ >+ if (internals.nowPlayingState[attribute] != expected) >+ return; >+ >+ await new Promise(resolve => setTimeout(resolve, 100)); >+ } while (new Date().getTime() - start < 500); >+ >+ failTest(`** Timed out waiting for "${attribute}" to change from "${expected}"`); >+ } >+ >+ async function runTest() >+ { >+ findMediaElement(); >+ >+ consoleWrite('<br>* NowPlaying should not be active before playback has started.'); >+ run('video.src = findMediaFile("video", "resources/test")'); >+ await waitFor(video, 'canplaythrough'); >+ >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', false); >+ >+ consoleWrite('<br>* Start to play, NowPlaying should become active.'); >+ runWithKeyDown(() => { >+ run('video.play()'); >+ }); >+ >+ await waitFor(video, 'playing'); >+ run('video.pause()'); >+ await waitForAttributeToChange('registeredAsNowPlayingApplication', false); >+ >+ consoleWrite('<br>* Title should be page title because video has no title.'); >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', true); >+ testExpected('nowPlayingState.title', 'Page Title'); >+ testExpected('nowPlayingState.duration', '0', '>'); >+ testExpected('nowPlayingState.elapsedTime', '0', '>='); >+ previousNowPlayingState = nowPlayingState; >+ >+ >+ consoleWrite('<br>* Set video title, it should be used.'); >+ run('video.title = "Video Title"'); >+ await waitForAttributeToChange('title', 'Page Title'); >+ >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', true); >+ testExpected('nowPlayingState.title', 'Video Title'); >+ testExpected('nowPlayingState.duration', '0', '>'); >+ >+ // Don't use "testExpected" for time and identifier unless we know the test failed >+ // because the values will be different from run to run. >+ if (nowPlayingState.uniqueIdentifier != previousNowPlayingState.uniqueIdentifier) >+ testExpected('nowPlayingState.uniqueIdentifier', previousNowPlayingState.uniqueIdentifier); >+ if (nowPlayingState.elapsedTime != previousNowPlayingState.elapsedTime) >+ testExpected('nowPlayingState.elapsedTime', previousNowPlayingState.elapsedTime); >+ previousNowPlayingState = nowPlayingState; >+ >+ consoleWrite('<br>* Clear video and page titles, page domain should be used.'); >+ run('video.title = ""'); >+ run('document.title = ""'); >+ await waitForAttributeToChange('title', 'Video Title'); >+ >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', true); >+ testExpected('nowPlayingState.title', '127.0.0.1'); >+ testExpected('nowPlayingState.duration', '0', '>'); >+ if (nowPlayingState.uniqueIdentifier != previousNowPlayingState.uniqueIdentifier) >+ testExpected('nowPlayingState.uniqueIdentifier', previousNowPlayingState.uniqueIdentifier); >+ if (nowPlayingState.elapsedTime != previousNowPlayingState.elapsedTime) >+ testExpected('nowPlayingState.elapsedTime', previousNowPlayingState.elapsedTime); >+ previousNowPlayingState = nowPlayingState; >+ >+ consoleWrite('<br>* Change currentTime, state should be updated.'); >+ run('video.currentTime = video.currentTime + 0.5'); >+ await waitForAttributeToChange('elapsedTime', previousNowPlayingState.elapsedTime); >+ >+ run('nowPlayingState = internals.nowPlayingState'); >+ testExpected('nowPlayingState.registeredAsNowPlayingApplication', true); >+ testExpected('nowPlayingState.title', '127.0.0.1'); >+ testExpected('nowPlayingState.duration', '0', '>'); >+ if (nowPlayingState.uniqueIdentifier != previousNowPlayingState.uniqueIdentifier) >+ testExpected('nowPlayingState.uniqueIdentifier', previousNowPlayingState.uniqueIdentifier); >+ if (nowPlayingState.elapsedTime == previousNowPlayingState.elapsedTime) >+ testExpected('nowPlayingState.elapsedTime', previousNowPlayingState.elapsedTime, '>'); >+ >+ consoleWrite(''); >+ endTest(); >+ } >+ </script> >+ </head> >+ <body onload="runTest()"> >+ <video controls ></video> >+ <br> >+ Tests that the NowPlaying information is updated correctly as attributes change. >+ </body> >+</html> >diff --git a/LayoutTests/media/video-test.js b/LayoutTests/media/video-test.js >index 6eb110f8fe16f1cfc5b2eb63f348f64aa6271c9a..67a356de39cf31b7eab7a565ce14e82054e3e224 100644 >--- a/LayoutTests/media/video-test.js >+++ b/LayoutTests/media/video-test.js >@@ -186,9 +186,9 @@ function run(testFuncString) > } > } > >-function waitFor(element, event) { >+function waitFor(element, type) { > return new Promise(resolve => { >- element.addEventListener(event, event => { >+ element.addEventListener(type, event => { > consoleWrite(`EVENT(${event.type})`); > resolve(event); > }, { once: true }); >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index d15c46eea860e42cc50f0ebd07af367aecdfdd33..92123f9c96c18eb966d15ebbc26555126a9180fd 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -1187,6 +1187,10 @@ webkit.org/b/180062 fast/text/user-installed-fonts [ Skip ] > > webkit.org/b/184295 http/wpt/loading/redirect-headers.html [ Skip ] > >+# NowPlaying is macOS and iOS only. >+http/tests/media/now-playing-info-private-browsing.html [ Skip ] >+http/tests/media/now-playing-info.html [ Skip ] >+ > #//////////////////////////////////////////////////////////////////////////////////////// > # End of Expected failures. > #
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185680
: 340504 |
340762
|
340763
|
340764
|
340766
|
340767
|
340769
|
340786
|
340880