Bug 1545680 [wpt PR 16368] - Fix flakiness in audioworklet-suspend.https.html, a=testonly
authorHongchan Choi <hongchan@chromium.org>
Fri, 17 May 2019 14:37:50 +0000
changeset 477009 bdbb5a9c6dc3790263efc2392dbef6c82aea2876
parent 477008 448886d5e30913028d118e214ca1e354f9a151db
child 477010 2e200b7bd108e3077f1ead2335e8cc0e5bc656e8
push id113326
push userjames@hoppipolla.co.uk
push dateWed, 05 Jun 2019 09:45:28 +0000
treeherdermozilla-inbound@6ab0d85288ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1545680, 16368, 953332, 1570129, 651437
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545680 [wpt PR 16368] - Fix flakiness in audioworklet-suspend.https.html, a=testonly Automatic update from web-platform-tests Fix flakiness in audioworklet-suspend.https.html It is because the actual suspension takes time to stop the render loop completely. So the current time advances a little after the suspension and the assertion that compares two timestamps fails. This CL fixes the problem by: 1. Suspend the context immediately after its creation. 2. Cache timestamp A after the worklet module loading is completed. 3. Check timestamp B after 500ms. If the context is not suspended (which is the original bug), two timestamps A and B won't match. Bug: 953332 Test: external/wpt/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html Change-Id: I3fc4ccf78ec9c137128f8605d502692be303b02e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1570129 Reviewed-by: Raymond Toy <rtoy@chromium.org> Reviewed-by: Robert Ma <robertma@chromium.org> Commit-Queue: Hongchan Choi <hongchan@chromium.org> Cr-Commit-Position: refs/heads/master@{#651437} -- wpt-commits: 3f690a244306cae2276fd1e5f620f5e83096a445 wpt-pr: 16368
testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html
--- a/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html
+++ b/testing/web-platform/tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html
@@ -9,30 +9,32 @@
     <script src="/webaudio/resources/audit.js"></script>
   </head>
   <body>
     <script id="layout-test-code">
       const audit = Audit.createTaskRunner();
       const context = new AudioContext();
       const filePath = 'processors/dummy-processor.js';
 
+      context.suspend();
+
       // Suspends the context right away and then activate worklet. The current
       // time must not advance since the context is suspended.
       audit.define(
           {label: 'load-worklet-and-suspend'},
           async (task, should) => {
-            context.suspend();
+            await context.audioWorklet.addModule(filePath);
             const suspendTime = context.currentTime;
-            await context.audioWorklet.addModule(filePath);
             const dummy = new AudioWorkletNode(context, 'dummy');
             dummy.connect(context.destination);
             task.timeout(() => {
-              should(context.currentTime, 'context.currentTime')
-                  .beEqualTo(suspendTime);
+              should(context.currentTime === suspendTime,
+                     'context.currentTime did not change after worklet started')
+                  .beTrue();
               should(context.state, 'context.state').beEqualTo('suspended');
               task.done();
-            }, 1000);
+            }, 500);
           });
 
       audit.run();
     </script>
   </body>
 </html>