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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic.html

Issue 2677723002: Convert Oscillator tests to testharness (Closed)
Patch Set: Created 3 years, 10 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 | third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic-expected.txt » ('j') | 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 2
3 <!-- 3 <!--
4 Create an oscillator of each type and verify that the type is set correctly. 4 Create an oscillator of each type and verify that the type is set correctly.
5 --> 5 -->
6 <html> 6 <html>
7 <head> 7 <head>
8 <script src="../../resources/js-test.js"></script> 8 <script src="../../resources/testharness.js"></script>
9 <script src="../../resources/testharnessreport.js"></script>
9 <script src="../resources/audit-util.js"></script> 10 <script src="../resources/audit-util.js"></script>
10 <script src="../resources/audio-testing.js"></script> 11 <script src="../resources/audio-testing.js"></script>
11 </head> 12 </head>
12 13
13 <body> 14 <body>
14 <div id="description"></div>
15 <div id="console"></div>
16
17 <script> 15 <script>
18 description("Basic test of setting Oscillator node types.");
19
20 var sampleRate = 44100; 16 var sampleRate = 44100;
21 var renderLengthSeconds = 0.25; 17 var renderLengthSeconds = 0.25;
22 18
23 var oscTypes = ["sine", "square", "sawtooth", "triangle", "custom"]; 19 var oscTypes = ["sine", "square", "sawtooth", "triangle", "custom"];
24 20
25 function runTest() 21 function runTest()
26 { 22 {
27 if (window.testRunner) {
28 testRunner.dumpAsText();
29 testRunner.waitUntilDone();
30 }
31
32 window.jsTestIsAsync = true;
33
34 // Create offline audio context. 23 // Create offline audio context.
35 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s ampleRate); 24 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s ampleRate);
36 var osc = context.createOscillator(); 25 var osc = context.createOscillator();
37 26
38 // Set each possible oscillator type (except CUSTOM) and verify that the typ e is correct. 27 // Set each possible oscillator type (except CUSTOM) and verify that the typ e is correct.
39 // Here we're setting the type using WebIDL enum values which are strings. 28 // Here we're setting the type using WebIDL enum values which are strings.
40 for (var k = 0; k < oscTypes.length - 1; ++k) { 29 for (var k = 0; k < oscTypes.length - 1; ++k) {
41 osc.type = oscTypes[k]; 30 osc.type = oscTypes[k];
42 Should("osc.type = '" + oscTypes[k] + "'", osc.type).beEqualTo(oscTypes[ k]); 31 Should("osc.type = '" + oscTypes[k] + "'", osc.type).beEqualTo(oscTypes[ k]);
43 } 32 }
(...skipping 13 matching lines...) Expand all
57 Should("osc.setPeriodicWave(wave)", function () { 46 Should("osc.setPeriodicWave(wave)", function () {
58 osc.setPeriodicWave(wave); 47 osc.setPeriodicWave(wave);
59 }).notThrow(); 48 }).notThrow();
60 Should("osc.type", osc.type).beEqualTo("custom"); 49 Should("osc.type", osc.type).beEqualTo("custom");
61 50
62 // Check that numerical values are no longer supported 51 // Check that numerical values are no longer supported
63 var oldType = osc.type; 52 var oldType = osc.type;
64 osc.type = 0; 53 osc.type = 0;
65 Should("osc.type = 0", osc.type).notBeEqualTo(0); 54 Should("osc.type = 0", osc.type).notBeEqualTo(0);
66 Should("osc.type", osc.type).beEqualTo(oldType); 55 Should("osc.type", osc.type).beEqualTo(oldType);
67
68 finishJSTest();
69 } 56 }
70 57
71 runTest(); 58 runTest();
72 successfullyParsed = true;
73
74 </script> 59 </script>
75 60
76 61
77 </body> 62 </body>
78 </html> 63 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/Oscillator/oscillator-basic-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698