[iOS] Muted media playback can interrupt out-of-process audio
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKitLegacy / ios / AudioSessionCategoryIOS.mm
index 7ae266cc552a2c223661e32dec1ac3f5d17471ef..72c5dac0cdbe6d3169fae56e811b733ee63d0c09 100644 (file)
@@ -30,7 +30,7 @@
 #import "PlatformUtilities.h"
 #import <AVFoundation/AVAudioSession.h>
 #import <UIKit/UIKit.h>
-#import <WebCore/Settings.h>
+#import <WebCore/DeprecatedGlobalSettings.h>
 #import <WebKit/WebKitLegacy.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/SoftLinking.h>
@@ -59,9 +59,9 @@ static bool didBeginPlaying = false;
 
 namespace TestWebKitAPI {
 
-TEST(WebKit1, AudioSessionCategoryIOS)
+TEST(WebKitLegacy, AudioSessionCategoryIOS)
 {
-    WebCore::Settings::setShouldManageAudioSessionCategory(true);
+    WebCore::DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(true);
     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()];
@@ -101,6 +101,14 @@ TEST(WebKit1, AudioSessionCategoryIOS)
     Util::run(&didBeginPlaying);
 
     EXPECT_WK_STREQ(getAVAudioSessionCategoryAmbient(), [[getAVAudioSessionClass() sharedInstance] category]);
+
+    didBeginPlaying = false;
+
+    [uiWebView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"video-with-paused-audio-and-playing-muted" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+
+    Util::run(&didBeginPlaying);
+
+    EXPECT_WK_STREQ(getAVAudioSessionCategoryAmbient(), [[getAVAudioSessionClass() sharedInstance] category]);
 }
 
 }