Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Analyser/automatic-pull-node.html

Issue 2611823002: Fix flaky automatic-pull-node test (Closed)
Patch Set: Use anon functions Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../resources/audit-util.js"></script> 7 <script src="../resources/audit-util.js"></script>
8 <script src="../resources/audit.js"></script> 8 <script src="../resources/audit.js"></script>
9 </head> 9 </head>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 // To verify the realtimeAnalyser can pull data when there is an upstream node 58 // To verify the realtimeAnalyser can pull data when there is an upstream node
59 // connected to it but it's not connected to a downstream node. 59 // connected to it but it's not connected to a downstream node.
60 audit.define("test1", function (task, should) { 60 audit.define("test1", function (task, should) {
61 constructCommonGraph(); 61 constructCommonGraph();
62 62
63 bufferSource.start(0); 63 bufferSource.start(0);
64 64
65 context.startRendering() 65 context.startRendering()
66 .then(test1Finished(should)) 66 .then(function () {
67 test1Finished(should);
68 })
67 .then(task.done.bind(task)); 69 .then(task.done.bind(task));
68 }); 70 });
69 71
70 function test2Finished(should) { 72 function test2Finished(should) {
71 var timeDomainData = new Uint8Array(fftSize); 73 var timeDomainData = new Uint8Array(fftSize);
72 analyser.getByteTimeDomainData(timeDomainData); 74 analyser.getByteTimeDomainData(timeDomainData);
73 75
74 should(timeDomainData[0] >= audioDataOne, 76 should(timeDomainData[0] >= audioDataOne,
75 "RealtimeAnalyserNode got pulled when connected from upstream node and to destination node" 77 "RealtimeAnalyserNode got pulled when connected from upstream node and to destination node"
76 ) 78 )
77 .beTrue(); 79 .beTrue();
78 } 80 }
79 81
80 // To verify the realtimeAnalyser can process normally when there is an upstream 82 // To verify the realtimeAnalyser can process normally when there is an upstream
81 // node connected to it and it's also connected to a downstream node which 83 // node connected to it and it's also connected to a downstream node which
82 // ultimately connect to audio destination. 84 // ultimately connect to audio destination.
83 audit.define("test2", function (task, should) { 85 audit.define("test2", function (task, should) {
84 constructCommonGraph(); 86 constructCommonGraph();
85 87
86 analyser.connect(context.destination); 88 analyser.connect(context.destination);
87 89
88 bufferSource.start(0); 90 bufferSource.start(0);
89 91
90 context.startRendering() 92 context.startRendering()
91 .then(test2Finished(should)) 93 .then(function () {
94 test2Finished(should);
95 })
92 .then(task.done.bind(task)); 96 .then(task.done.bind(task));
93 }); 97 });
94 98
95 function test3Finished(should) { 99 function test3Finished(should) {
96 var timeDomainData = new Uint8Array(fftSize); 100 var timeDomainData = new Uint8Array(fftSize);
97 analyser.getByteTimeDomainData(timeDomainData); 101 analyser.getByteTimeDomainData(timeDomainData);
98 102
99 // If realtimeAnalyser hasn't pulled any data, the data in buffer will be 0. 103 // If realtimeAnalyser hasn't pulled any data, the data in buffer will be 0.
100 should(timeDomainData[0] == audioDataZero, 104 should(timeDomainData[0] == audioDataZero,
101 "RealtimeAnalyserNode didn't get pulled when it should not") 105 "RealtimeAnalyserNode didn't get pulled when it should not")
102 .beTrue();; 106 .beTrue();;
103 } 107 }
104 108
105 // To verify the realtimeAnalyser will stop pulling if it is connected to a 109 // To verify the realtimeAnalyser will stop pulling if it is connected to a
106 // downstream node which is not ultimatly connected to any audio destination. 110 // downstream node which is not ultimatly connected to any audio destination.
107 audit.define("test3", function (task, should) { 111 audit.define("test3", function (task, should) {
108 constructCommonGraph(); 112 constructCommonGraph();
109 113
110 var gain = context.createGain(); 114 var gain = context.createGain();
111 analyser.connect(gain); 115 analyser.connect(gain);
112 116
113 bufferSource.start(0); 117 bufferSource.start(0);
114 118
115 context.startRendering() 119 context.startRendering()
116 .then(test3Finished(should)) 120 .then(function () {
121 test3Finished(should);
122 })
117 .then(task.done.bind(task)); 123 .then(task.done.bind(task));
118 }); 124 });
119 125
120 audit.run(); 126 audit.run();
121 127
122 </script> 128 </script>
123 129
124 </body> 130 </body>
125 </html> 131 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698