Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title> | |
| 5 OfflineAudioContext - Thread Creation | |
| 6 </title> | |
| 7 <script src="../../resources/testharness.js"></script> | |
| 8 <script src="../../resources/testharnessreport.js"></script> | |
| 9 <script src="../resources/audit.js"></script> | |
| 10 </head> | |
| 11 <body> | |
| 12 <script id="layout-test-code"> | |
| 13 const audit = Audit.createTaskRunner(); | |
| 14 | |
| 15 // The common sample rate. | |
| 16 const sampleRate = 48000; | |
| 17 | |
| 18 // To make channel count and buffer length irrelevant to this test. | |
| 19 const numberOfChannels = 1; | |
| 20 const renderLength = 1; | |
| 21 | |
| 22 // Create 2500 contexts in total. | |
| 23 const maxNumberOfContexts = 5000; | |
| 24 | |
| 25 // Create multiple contexts and drop them rapidly. This should not crash | |
| 26 // the browser with out-of-threads error. The test code here is based on | |
| 27 // crbug.com/716800. | |
| 28 audit.define( | |
| 29 { | |
| 30 label: 'thread-creation', | |
| 31 description: | |
| 32 'Creating ' + maxNumberOfContexts + ' contexts without a crash.' | |
| 33 }, | |
| 34 (task, should) => { | |
| 35 let i; | |
| 36 for (i = 0; i < maxNumberOfContexts; ++i) { | |
| 37 let context = new OfflineAudioContext( | |
| 38 numberOfChannels, renderLength, sampleRate); | |
| 39 delete context; | |
| 40 } | |
| 41 | |
| 42 should(i, 'The number of created contexts without a crash') | |
|
Raymond Toy
2017/05/23 18:38:27
This is kind of odd because if it crashes, we'll n
hongchan
2017/05/23 20:30:19
Like you pointed out, the out-of-thread immediatel
| |
| 43 .beEqualTo(maxNumberOfContexts); | |
| 44 task.done(); | |
| 45 }); | |
| 46 | |
| 47 audit.run(); | |
| 48 </script> | |
| 49 </body> | |
| 50 </html> | |
| OLD | NEW |