⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267423 in webkit


Ignore:
Timestamp:
Sep 22, 2020, 11:30:53 AM (6 years ago)
Author:
Russell Epstein
Message:

Revert "Cherry-pick r266121. rdar://problem/68949249"

Location:
branches/safari-610.2.5.1-branch
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610.2.5.1-branch/Source/WebCore/ChangeLog

    r267420 r267423  
    3535            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequests):
    3636            (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
    37 
    38 2020-09-15  Alan Coon  <alancoon@apple.com>
    39 
    40         Cherry-pick r266121. rdar://problem/68949249
    41 
    42     [macOS] Update audio arbitration manager when audio transport changes
    43     https://bugs.webkit.org/show_bug.cgi?id=215781
    44     <rdar://problem/65920613>
    45    
    46     Reviewed by Jer Noble.
    47    
    48     Source/WebCore:
    49    
    50     No new tests, updated AudioRoutingArbitration API test.
    51    
    52     * platform/audio/AudioSession.cpp:
    53     (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method.
    54     (WebCore::setIsPlayingToBluetoothOverride): Ditto.
    55     * platform/audio/AudioSession.h:
    56    
    57     * platform/audio/cocoa/MediaSessionManagerCocoa.h:
    58     * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
    59     (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged.
    60    
    61     * platform/audio/mac/AudioSessionMac.mm:
    62     (WebCore::defaultDeviceTransportIsBluetooth): New.
    63     (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth
    64     if bluetooth transport has changed since the last arbitration update.
    65     (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth
    66     transport for testing.
    67     (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category
    68     or bluetooth transport changes.
    69    
    70     * testing/Internals.cpp:
    71     (WebCore::Internals::setIsPlayingToBluetoothOverride):
    72     * testing/Internals.h:
    73     * testing/Internals.idl:
    74    
    75     Source/WebKit:
    76    
    77     * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
    78     * UIProcess/API/Cocoa/WKWebViewTesting.mm:
    79     (-[WKWebView _audioRoutingArbitrationUpdateTime]):
    80    
    81     * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
    82     (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const):
    83    
    84     * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
    85     (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
    86    
    87     Tools:
    88    
    89     * TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm:
    90     (AudioRoutingArbitration::statusShouldBecomeEqualTo): Add message string to help
    91     debugging when the test fails.
    92     * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html:
    93    
    94    
    95     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    96 
    97     2020-08-25  Eric Carlson  <eric.carlson@apple.com>
    98 
    99             [macOS] Update audio arbitration manager when audio transport changes
    100             https://bugs.webkit.org/show_bug.cgi?id=215781
    101             <rdar://problem/65920613>
    102 
    103             Reviewed by Jer Noble.
    104 
    105             No new tests, updated AudioRoutingArbitration API test.
    106 
    107             * platform/audio/AudioSession.cpp:
    108             (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method.
    109             (WebCore::setIsPlayingToBluetoothOverride): Ditto.
    110             * platform/audio/AudioSession.h:
    111 
    112             * platform/audio/cocoa/MediaSessionManagerCocoa.h:
    113             * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
    114             (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged.
    115 
    116             * platform/audio/mac/AudioSessionMac.mm:
    117             (WebCore::defaultDeviceTransportIsBluetooth): New.
    118             (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth
    119             if bluetooth transport has changed since the last arbitration update.
    120             (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth
    121             transport for testing.
    122             (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category
    123             or bluetooth transport changes.
    124 
    125             * testing/Internals.cpp:
    126             (WebCore::Internals::setIsPlayingToBluetoothOverride):
    127             * testing/Internals.h:
    128             * testing/Internals.idl:
    12937
    130382020-09-11  Alan Coon  <alancoon@apple.com>
  • branches/safari-610.2.5.1-branch/Source/WebCore/platform/audio/AudioSession.cpp

    r267119 r267423  
    164164#endif // !PLATFORM(COCOA)
    165165
    166 #if !PLATFORM(MAC)
    167 void AudioSession::audioOutputDeviceChanged()
    168 {
    169     notImplemented();
    170 }
    171 
    172 void AudioSession::setIsPlayingToBluetoothOverride(Optional<bool>)
    173 {
    174     notImplemented();
    175 }
    176 #endif // !PLATFORM(COCOA)
    177 
    178 
    179166String convertEnumerationToString(RouteSharingPolicy enumerationValue)
    180167{
  • branches/safari-610.2.5.1-branch/Source/WebCore/platform/audio/AudioSession.h

    r267119 r267423  
    9898    void removeMutedStateObserver(MutedStateObserver*);
    9999
    100     void audioOutputDeviceChanged();
    101     void setIsPlayingToBluetoothOverride(Optional<bool>);
    102 
    103100    virtual bool isMuted() const;
    104101    virtual void handleMutedStateChange();
  • branches/safari-610.2.5.1-branch/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.h

    r267119 r267423  
    9797    void audioHardwareDidBecomeActive() final { }
    9898    void audioHardwareDidBecomeInactive() final { }
    99     void audioOutputDeviceChanged() final;
     99    void audioOutputDeviceChanged() final { updateSessionState(); }
    100100
    101101    // PAL::SystemSleepListener
  • branches/safari-610.2.5.1-branch/Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm

    r267119 r267423  
    367367}
    368368
    369 void MediaSessionManagerCocoa::audioOutputDeviceChanged()
    370 {
    371     AudioSession::sharedSession().audioOutputDeviceChanged();
    372     updateSessionState();
    373 }
    374 
    375369} // namespace WebCore
    376370
  • branches/safari-610.2.5.1-branch/Source/WebCore/platform/audio/mac/AudioSessionMac.mm

    r267119 r267423  
    5555}
    5656
    57 #if ENABLE(ROUTING_ARBITRATION)
    58 static Optional<bool> isPlayingToBluetoothOverride;
    59 
    60 static float defaultDeviceTransportIsBluetooth()
    61 {
    62     if (isPlayingToBluetoothOverride)
    63         return *isPlayingToBluetoothOverride;
    64 
    65     static const AudioObjectPropertyAddress audioDeviceTransportTypeProperty = {
    66         kAudioDevicePropertyTransportType,
    67         kAudioObjectPropertyScopeGlobal,
    68         kAudioObjectPropertyElementMaster,
    69     };
    70     UInt32 transportType = kAudioDeviceTransportTypeUnknown;
    71     UInt32 transportSize = sizeof(transportType);
    72     if (AudioObjectGetPropertyData(defaultDevice(), &audioDeviceTransportTypeProperty, 0, 0, &transportSize, &transportType))
    73         return false;
    74 
    75     return transportType == kAudioDeviceTransportTypeBluetooth || transportType == kAudioDeviceTransportTypeBluetoothLE;
    76 }
    77 #endif
    78 
    7957class AudioSessionPrivate {
    8058    WTF_MAKE_FAST_ALLOCATED;
     
    8563#if ENABLE(ROUTING_ARBITRATION)
    8664    bool setupArbitrationOngoing { false };
    87     Optional<bool> playingToBluetooth;
    88     Optional<bool> playingToBluetoothOverride;
    8965#endif
    9066    AudioSession::CategoryType m_categoryOverride;
     
    10480}
    10581
    106 void AudioSession::audioOutputDeviceChanged()
     82void AudioSession::setCategory(CategoryType category, RouteSharingPolicy)
    10783{
    10884#if ENABLE(ROUTING_ARBITRATION)
    109     if (!m_private->playingToBluetooth || *m_private->playingToBluetooth == defaultDeviceTransportIsBluetooth())
    110         return;
    111 
    112     m_private->playingToBluetooth = WTF::nullopt;
    113 #endif
    114 }
    115 
    116 void AudioSession::setIsPlayingToBluetoothOverride(Optional<bool> value)
    117 {
    118 #if ENABLE(ROUTING_ARBITRATION)
    119     isPlayingToBluetoothOverride = value;
    120 #else
    121     UNUSED_PARAM(value);
    122 #endif
    123 }
    124 
    125 void AudioSession::setCategory(CategoryType category, RouteSharingPolicy)
    126 {
    127 #if ENABLE(ROUTING_ARBITRATION)
    128     bool playingToBluetooth = defaultDeviceTransportIsBluetooth();
    129     if (category == m_private->category && m_private->playingToBluetooth && *m_private->playingToBluetooth == playingToBluetooth)
    130         return;
    131 
     85    if (category == m_private->category)
     86        return;
    13287    m_private->category = category;
    13388
     
    151106    using DefaultRouteChanged = AudioSessionRoutingArbitrationClient::DefaultRouteChanged;
    152107
    153     m_private->playingToBluetooth = playingToBluetooth;
    154108    m_private->setupArbitrationOngoing = true;
    155109    m_routingArbitrationClient->beginRoutingArbitrationWithCategory(m_private->category, [this] (RoutingArbitrationError error, DefaultRouteChanged defaultRouteChanged) {
  • branches/safari-610.2.5.1-branch/Source/WebCore/testing/Internals.cpp

    r267119 r267423  
    49444944#endif
    49454945
    4946 ExceptionOr<void> Internals::setIsPlayingToBluetoothOverride(Optional<bool> isPlaying)
    4947 {
    4948 #if ENABLE(ROUTING_ARBITRATION)
    4949     AudioSession::sharedSession().setIsPlayingToBluetoothOverride(isPlaying);
    4950     return { };
    4951 #else
    4952     UNUSED_PARAM(isPlaying);
    4953     return Exception { NotSupportedError };
    4954 #endif
    4955 }
    4956 
    49574946void Internals::reportBacktrace()
    49584947{
  • branches/safari-610.2.5.1-branch/Source/WebCore/testing/Internals.h

    r267119 r267423  
    625625#endif
    626626
    627     ExceptionOr<void> setIsPlayingToBluetoothOverride(Optional<bool>);
    628 
    629627    bool isSelectPopupVisible(HTMLSelectElement&);
    630628
  • branches/safari-610.2.5.1-branch/Source/WebCore/testing/Internals.idl

    r267119 r267423  
    653653    [Conditional=VIDEO] double privatePlayerVolume(HTMLMediaElement media);
    654654
    655     [MayThrowException] void setIsPlayingToBluetoothOverride(optional boolean? isPlaying = null);
    656 
    657655    [Conditional=LEGACY_ENCRYPTED_MEDIA] void initializeMockCDM();
    658656    [Conditional=ENCRYPTED_MEDIA] MockCDMFactory registerMockCDM();
  • branches/safari-610.2.5.1-branch/Source/WebKit/ChangeLog

    r267119 r267423  
    1 2020-09-15  Alan Coon  <alancoon@apple.com>
    2 
    3         Cherry-pick r266121. rdar://problem/68949249
    4 
    5     [macOS] Update audio arbitration manager when audio transport changes
    6     https://bugs.webkit.org/show_bug.cgi?id=215781
    7     <rdar://problem/65920613>
    8    
    9     Reviewed by Jer Noble.
    10    
    11     Source/WebCore:
    12    
    13     No new tests, updated AudioRoutingArbitration API test.
    14    
    15     * platform/audio/AudioSession.cpp:
    16     (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method.
    17     (WebCore::setIsPlayingToBluetoothOverride): Ditto.
    18     * platform/audio/AudioSession.h:
    19    
    20     * platform/audio/cocoa/MediaSessionManagerCocoa.h:
    21     * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
    22     (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged.
    23    
    24     * platform/audio/mac/AudioSessionMac.mm:
    25     (WebCore::defaultDeviceTransportIsBluetooth): New.
    26     (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth
    27     if bluetooth transport has changed since the last arbitration update.
    28     (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth
    29     transport for testing.
    30     (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category
    31     or bluetooth transport changes.
    32    
    33     * testing/Internals.cpp:
    34     (WebCore::Internals::setIsPlayingToBluetoothOverride):
    35     * testing/Internals.h:
    36     * testing/Internals.idl:
    37    
    38     Source/WebKit:
    39    
    40     * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
    41     * UIProcess/API/Cocoa/WKWebViewTesting.mm:
    42     (-[WKWebView _audioRoutingArbitrationUpdateTime]):
    43    
    44     * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
    45     (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const):
    46    
    47     * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
    48     (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
    49    
    50     Tools:
    51    
    52     * TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm:
    53     (AudioRoutingArbitration::statusShouldBecomeEqualTo): Add message string to help
    54     debugging when the test fails.
    55     * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html:
    56    
    57    
    58     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    59 
    60     2020-08-25  Eric Carlson  <eric.carlson@apple.com>
    61 
    62             [macOS] Update audio arbitration manager when audio transport changes
    63             https://bugs.webkit.org/show_bug.cgi?id=215781
    64             <rdar://problem/65920613>
    65 
    66             Reviewed by Jer Noble.
    67 
    68             * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
    69             * UIProcess/API/Cocoa/WKWebViewTesting.mm:
    70             (-[WKWebView _audioRoutingArbitrationUpdateTime]):
    71 
    72             * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
    73             (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const):
    74 
    75             * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
    76             (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
    77 
    7812020-09-11  Alan Coon  <alancoon@apple.com>
    792
  • branches/safari-610.2.5.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h

    r267119 r267423  
    7575- (BOOL)_hasSleepDisabler;
    7676- (WKWebViewAudioRoutingArbitrationStatus)_audioRoutingArbitrationStatus;
    77 - (double)_audioRoutingArbitrationUpdateTime;
    7877@end
  • branches/safari-610.2.5.1-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm

    r267119 r267423  
    263263}
    264264
    265 - (double)_audioRoutingArbitrationUpdateTime
    266 {
    267 #if ENABLE(ROUTING_ARBITRATION)
    268     return _page->process().audioSessionRoutingArbitrator().arbitrationUpdateTime().secondsSinceEpoch().seconds();
    269 #else
    270     return 0;
    271 #endif
    272 }
    273 
    274265@end
  • branches/safari-610.2.5.1-branch/Source/WebKit/UIProcess/Media/AudioSessionRoutingArbitratorProxy.h

    r267119 r267423  
    3030#include "MessageReceiver.h"
    3131#include <WebCore/AudioSession.h>
    32 #include <wtf/WallTime.h>
    3332#include <wtf/WeakPtr.h>
    3433
     
    6160
    6261    ArbitrationStatus arbitrationStatus() const { return m_arbitrationStatus; }
    63     WallTime arbitrationUpdateTime() const { return m_arbitrationUpdateTime; }
    6462
    6563private:
     
    7472    WebCore::AudioSession::CategoryType m_category { WebCore::AudioSession::None };
    7573    ArbitrationStatus m_arbitrationStatus { ArbitrationStatus::None };
    76     WallTime m_arbitrationUpdateTime;
    7774};
    7875
  • branches/safari-610.2.5.1-branch/Source/WebKit/UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm

    r267119 r267423  
    179179    m_category = category;
    180180    m_arbitrationStatus = ArbitrationStatus::Pending;
    181     m_arbitrationUpdateTime = WallTime::now();
    182181    SharedArbitrator::sharedInstance().beginRoutingArbitrationForArbitrator(*this, [weakThis = makeWeakPtr(*this), callback = WTFMove(callback)] (RoutingArbitrationError error, DefaultRouteChanged routeChanged) mutable {
    183182        if (weakThis)
  • branches/safari-610.2.5.1-branch/Tools/ChangeLog

    r267119 r267423  
    1 2020-09-15  Alan Coon  <alancoon@apple.com>
    2 
    3         Cherry-pick r266121. rdar://problem/68949249
    4 
    5     [macOS] Update audio arbitration manager when audio transport changes
    6     https://bugs.webkit.org/show_bug.cgi?id=215781
    7     <rdar://problem/65920613>
    8    
    9     Reviewed by Jer Noble.
    10    
    11     Source/WebCore:
    12    
    13     No new tests, updated AudioRoutingArbitration API test.
    14    
    15     * platform/audio/AudioSession.cpp:
    16     (WebCore::AudioSession::audioOutputDeviceChanged): Add empty method.
    17     (WebCore::setIsPlayingToBluetoothOverride): Ditto.
    18     * platform/audio/AudioSession.h:
    19    
    20     * platform/audio/cocoa/MediaSessionManagerCocoa.h:
    21     * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
    22     (WebCore::MediaSessionManagerCocoa::audioOutputDeviceChanged): Call AudioSession::audioOutputDeviceChanged.
    23    
    24     * platform/audio/mac/AudioSessionMac.mm:
    25     (WebCore::defaultDeviceTransportIsBluetooth): New.
    26     (WebCore::AudioSession::audioOutputDeviceChanged): Clear m_private->playingToBluetooth
    27     if bluetooth transport has changed since the last arbitration update.
    28     (WebCore::AudioSession::setIsPlayingToBluetoothOverride): Allow override of bluetooth
    29     transport for testing.
    30     (WebCore::AudioSession::setCategory): Update routing arbitration if audio session category
    31     or bluetooth transport changes.
    32    
    33     * testing/Internals.cpp:
    34     (WebCore::Internals::setIsPlayingToBluetoothOverride):
    35     * testing/Internals.h:
    36     * testing/Internals.idl:
    37    
    38     Source/WebKit:
    39    
    40     * UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
    41     * UIProcess/API/Cocoa/WKWebViewTesting.mm:
    42     (-[WKWebView _audioRoutingArbitrationUpdateTime]):
    43    
    44     * UIProcess/Media/AudioSessionRoutingArbitratorProxy.h:
    45     (WebKit::AudioSessionRoutingArbitratorProxy::arbitrationUpdateTime const):
    46    
    47     * UIProcess/Media/cocoa/AudioSessionRoutingArbitratorProxyCocoa.mm:
    48     (WebKit::AudioSessionRoutingArbitratorProxy::beginRoutingArbitrationWithCategory):
    49    
    50     Tools:
    51    
    52     * TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm:
    53     (AudioRoutingArbitration::statusShouldBecomeEqualTo): Add message string to help
    54     debugging when the test fails.
    55     * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html:
    56    
    57    
    58     git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266121 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    59 
    60     2020-08-25  Eric Carlson  <eric.carlson@apple.com>
    61 
    62             [macOS] Update audio arbitration manager when audio transport changes
    63             https://bugs.webkit.org/show_bug.cgi?id=215781
    64             <rdar://problem/65920613>
    65 
    66             Reviewed by Jer Noble.
    67 
    68             * TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm:
    69             (AudioRoutingArbitration::statusShouldBecomeEqualTo): Add message string to help
    70             debugging when the test fails.
    71             * TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html:
    72 
    7312020-09-03  Alan Coon  <alancoon@apple.com>
    742
  • branches/safari-610.2.5.1-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/AudioRoutingArbitration.mm

    r267119 r267423  
    3434#import <WebKit/WKWebViewPrivate.h>
    3535#import <WebKit/WKWebViewPrivateForTesting.h>
    36 #import <wtf/WallTime.h>
    3736
    3837class AudioRoutingArbitration : public testing::Test {
     
    4342    {
    4443        auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
    45         WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
    46         configuration.get().processPool = (WKProcessPool *)context.get();
    4744        configuration.get()._mediaDataLoadsAutomatically = YES;
    4845        configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
     
    6057    }
    6158
    62     void statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatus status, const char* message)
     59    void statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatus status)
    6360    {
    6461        int tries = 0;
     
    7067        } while (++tries <= 100);
    7168
    72         EXPECT_EQ(status, [webView _audioRoutingArbitrationStatus]) << message;
     69        EXPECT_EQ(status, [webView _audioRoutingArbitrationStatus]);
    7370    }
    7471};
     
    7673TEST_F(AudioRoutingArbitration, Basic)
    7774{
    78     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Basic");
     75    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    7976}
    8077
    8178TEST_F(AudioRoutingArbitration, Mute)
    8279{
    83     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Mute 1");
     80    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    8481
    8582    [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').muted = true"];
    8683
    87     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone, "Mute 2");
     84    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone);
    8885
    8986    [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').muted = false"];
    9087
    91     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Mute 3");
     88    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    9289}
    9390
    9491TEST_F(AudioRoutingArbitration, Navigation)
    9592{
    96     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Navigation 1");
     93    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    9794
    9895    [webView synchronouslyLoadHTMLString:@"<html>no contents</html>"];
    9996
    100     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone, "Navigation 2");
     97    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone);
    10198}
    10299
    103100TEST_F(AudioRoutingArbitration, Deletion)
    104101{
    105     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Deletion 1");
     102    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    106103
    107104    [webView objectByEvaluatingJavaScriptWithUserGesture:@"document.querySelector('video').parentNode.innerHTML = ''"];
    108105
    109     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone, "Deletion 2");
     106    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone);
    110107}
    111108
    112109TEST_F(AudioRoutingArbitration, Close)
    113110{
    114     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Close 1");
     111    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive);
    115112
    116113    [webView _close];
    117114
    118     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone, "Close 2");
     115    statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusNone);
    119116}
    120117
    121 TEST_F(AudioRoutingArbitration, Updating)
    122 {
    123     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Updating 1");
    124 
    125     [webView evaluateJavaScript:@"document.querySelector('video').pause()" completionHandler:nil];
    126     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Updating 2");
    127 
    128     auto start = WallTime::now().secondsSinceEpoch().seconds();
    129     auto arbitrationUpdateTime = [webView _audioRoutingArbitrationUpdateTime];
    130     ASSERT_TRUE(arbitrationUpdateTime < start);
    131 
    132     [webView evaluateJavaScript:@"document.querySelector('video').play()" completionHandler:nil];
    133     EXPECT_EQ(arbitrationUpdateTime, [webView _audioRoutingArbitrationUpdateTime]) << "Arbitration was unexpectedly updated";
    134     statusShouldBecomeEqualTo(WKWebViewAudioRoutingArbitrationStatusActive, "Updating 3");
    135 
    136     [webView evaluateJavaScript:@"document.querySelector('video').pause()" completionHandler:nil];
    137     [webView stringByEvaluatingJavaScript:@"window.internals.setIsPlayingToBluetoothOverride(true)"];
    138 
    139     [webView evaluateJavaScript:@"document.querySelector('video').play()" completionHandler:nil];
    140 
    141     int tries = 0;
    142     do {
    143         if ([webView _audioRoutingArbitrationUpdateTime] > arbitrationUpdateTime)
    144             break;
    145 
    146         TestWebKitAPI::Util::sleep(0.1);
    147     } while (++tries <= 100);
    148 
    149     EXPECT_LT(arbitrationUpdateTime, [webView _audioRoutingArbitrationUpdateTime]) << "Arbitration was not updated";
    150 
    151     [webView stringByEvaluatingJavaScript:@"window.internals.setIsPlayingToBluetoothOverride()"];
    152 }
    153118
    154119#endif
  • branches/safari-610.2.5.1-branch/Tools/TestWebKitAPI/Tests/WebKitLegacy/ios/video-with-audio.html

    r267119 r267423  
    33<head>
    44    <script>
     5    var timeout;
     6
    57    function go() {
    68        var video = document.getElementsByTagName('video')[0];
     
    2830    }
    2931
    30     function pause() {
    31         let video = document.getElementsByTagName('video')[0];
    32         video.addEventListener("pause", paused, { once: true });
    33         video.pause();
    34     }
    35 
    36     function play() {
    37         go();
    38     }
    39 
    4032    document.addEventListener('pageshow', go);
    4133   </script>
Note: See TracChangeset for help on using the changeset viewer.