Title: [234986] trunk/Tools
Revision
234986
Author
[email protected]
Date
2018-08-17 10:27:42 -0700 (Fri, 17 Aug 2018)

Log Message

REGRESSION (234743) Timeouts in TestWebKitAPI.PreferredAudioBufferSize.AudioWithWebAudio and TestWebKitAPI.PreferredAudioBufferSize.WebAudio
https://bugs.webkit.org/show_bug.cgi?id=188470
<rdar://problem/43144969>

Reviewed by Alex Christensen.

On a loaded server, the WebContent process may send the "playing" message before the
UIProcess has a chance to register a listener for that message. Restructure the tests
so that the listener is registered before the page is loaded.

* TestWebKitAPI/Tests/WebKitCocoa/PreferredAudioBufferSize.mm:
(PreferredAudioBufferSize::runPlayingTestWithPageNamed):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (234985 => 234986)


--- trunk/Tools/ChangeLog	2018-08-17 16:41:03 UTC (rev 234985)
+++ trunk/Tools/ChangeLog	2018-08-17 17:27:42 UTC (rev 234986)
@@ -1,3 +1,19 @@
+2018-08-17  Jer Noble  <[email protected]>
+
+        REGRESSION (234743) Timeouts in TestWebKitAPI.PreferredAudioBufferSize.AudioWithWebAudio and TestWebKitAPI.PreferredAudioBufferSize.WebAudio
+        https://bugs.webkit.org/show_bug.cgi?id=188470
+        <rdar://problem/43144969>
+
+        Reviewed by Alex Christensen.
+
+        On a loaded server, the WebContent process may send the "playing" message before the
+        UIProcess has a chance to register a listener for that message. Restructure the tests
+        so that the listener is registered before the page is loaded.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/PreferredAudioBufferSize.mm:
+        (PreferredAudioBufferSize::runPlayingTestWithPageNamed):
+        (TEST_F):
+
 2018-08-16  Wenson Hsieh  <[email protected]>
 
         [macOS] [WK2] Add infrastructure to test receiving file promises on drop

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PreferredAudioBufferSize.mm (234985 => 234986)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PreferredAudioBufferSize.mm	2018-08-17 16:41:03 UTC (rev 234985)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PreferredAudioBufferSize.mm	2018-08-17 17:27:42 UTC (rev 234986)
@@ -57,8 +57,19 @@
         return [webView stringByEvaluatingJavaScript:@"window.internals.preferredAudioBufferSize()"].doubleValue;
     }
 
+    void runPlayingTestWithPageNamed(NSString* name, double expectedAudioBufferSize)
+    {
+        createView();
+        __block bool isPlaying = false;
+        [webView performAfterReceivingMessage:@"playing" action:^() { isPlaying = true; }];
+        [webView synchronouslyLoadTestPageNamed:name];
+        TestWebKitAPI::Util::run(&isPlaying);
+        EXPECT_EQ(expectedAudioBufferSize, preferredAudioBufferSize());
+    }
+
     RetainPtr<WKWebViewConfiguration> configuration;
     RetainPtr<TestWKWebView> webView;
+    bool isPlaying { false };
 };
 
 TEST_F(PreferredAudioBufferSize, Empty)
@@ -70,50 +81,32 @@
 
 TEST_F(PreferredAudioBufferSize, AudioElement)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"audio-only"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(4096, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"audio-only", 4096);
 }
 
-TEST_F(PreferredAudioBufferSize, DISABLED_WebAudio)
+TEST_F(PreferredAudioBufferSize, WebAudio)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"web-audio-only"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(128, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"web-audio-only", 128);
 }
 
 TEST_F(PreferredAudioBufferSize, VideoOnly)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"video-without-audio"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(512, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"video-without-audio", 512);
 }
 
 TEST_F(PreferredAudioBufferSize, VideoWithAudio)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"video-with-audio"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(4096, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"video-with-audio", 4096);
 }
 
-TEST_F(PreferredAudioBufferSize, DISABLED_AudioWithWebAudio)
+TEST_F(PreferredAudioBufferSize, AudioWithWebAudio)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"audio-with-web-audio"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(128, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"audio-with-web-audio", 128);
 }
 
 TEST_F(PreferredAudioBufferSize, VideoWithAudioAndWebAudio)
 {
-    createView();
-    [webView synchronouslyLoadTestPageNamed:@"video-with-audio-and-web-audio"];
-    [webView waitForMessage:@"playing"];
-    EXPECT_EQ(128, preferredAudioBufferSize());
+    runPlayingTestWithPageNamed(@"video-with-audio-and-web-audio", 128);
 }
 
 #endif // WK_HAVE_C_SPI && WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to