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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/event-constructor.html

Issue 2491653002: Add constructors for WebAudio events (Closed)
Patch Set: Add links to spec. Created 4 years, 1 month 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
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <head>
4 <title>Test Event Constructors</title>
5 <script src="../resources/testharness.js"></script>
6 <script src="../resources/testharnessreport.js"></script>
7 <script src="resources/audio-testing.js"></script>
foolip 2016/11/15 19:53:33 It looks like the test would be more compact witho
Raymond Toy 2016/11/15 22:07:42 Yeah, pretty much all newer tests are in this styl
8 </head>
9
10 <body>
11 <script>
12 var audit = Audit.createTaskRunner();
13
14 audit.defineTask("offline-constructor", function (taskDone) {
15 var event;
foolip 2016/11/15 19:53:33 event is never used in this test, so you could jus
Raymond Toy 2016/11/15 22:07:42 Done.
16 var success = true;
17
18 success = Should("new OfflineAudioCompletionEvent()", function () {
19 event = new OfflineAudioCompletionEvent();
20 }).throw() && success;
foolip 2016/11/15 19:53:33 I think 'TypeError' here and elsewhere would test
Raymond Toy 2016/11/15 22:07:42 Done. I meant to do this but forgot. :-(
21
22 success = Should('new OfflineAudioCompletionEvent("complete")', function () {
23 event = new OfflineAudioCompletionEvent("complete");
24 }).throw() && success;
25
26 success = Should('new OfflineAudioCompletionEvent("complete", {})', func tion () {
27 event = new OfflineAudioCompletionEvent("complete", {});
28 }).throw() && success;
29
30 success = Should('new OfflineAudioCompletionEvent("complete", {foo:42 }) ', function () {
31 event = new OfflineAudioCompletionEvent("complete", {foo: 42});
32 }).throw() && success;
33
34 var context = new OfflineAudioContext(1, 100, 48000);
35 var buffer = new AudioBuffer(context, {length: 42});
36
37 success = Should('new OfflineAudioCompletionEvent("complete")',
foolip 2016/11/15 19:53:33 This doesn't match what is tested.
Raymond Toy 2016/11/15 22:07:42 Done.
38 function () {
39 event = new OfflineAudioCompletionEvent("complete", {renderedBuffer: b uffer});
40 }).notThrow() && success;
41
42 Should("OfflineAudioCompletionEvent construction handled", success)
43 .summarize("correctly", "incorrectly");
44
45 taskDone();
46 });
47
48 audit.defineTask("offline-event", function (taskDone) {
49 var event;
50 var context = new OfflineAudioContext(1, 100, 48000);
51 var success = true;
52 success = Should("new OfflineAudioCompletionEvent()", function () {
53 event = new OfflineAudioCompletionEvent("foo", {renderedBuffer: new
54 AudioBuffer(context, {length: 10})});
55 }).notThrow() && success;
56
57 success = Should("event.renderedBuffer !== undefined", event.renderedBuf fer !== undefined)
foolip 2016/11/15 19:53:33 Can you assign the AudioBuffer to a variable and a
Raymond Toy 2016/11/15 22:07:42 Done.
58 .beEqualTo(true) && success;
59
60 Should("OfflineAudioCompletionEvent constructed", success)
61 .summarize("correctly",
foolip 2016/11/15 19:53:33 Accidental newline?
Raymond Toy 2016/11/15 22:07:42 Done.
62 "incorrectly");
63
64 taskDone();
65 });
66
67 audit.defineTask("audio-processing", function (taskDone) {
foolip 2016/11/15 19:53:32 For this, since all three dictionary members are r
Raymond Toy 2016/11/15 22:07:42 Done.
68 var event;
69 var context = new OfflineAudioContext(1, 100, 48000);
70
71 var input = new AudioBuffer(context, {length: 10});
72 var output = new AudioBuffer(context, {length: 20});
73
74 var success = true;
75 success = Should("new AudioProcessingEvent()", function () {
76 event = new AudioProcessingEvent("proc", {
77 inputBuffer: input,
78 outputBuffer: output,
79 playbackTime: Math.PI});
80 }).notThrow() && success;
81
82 success = Should("event.playbackTime !== undefined", event.playbackTime !== undefined)
foolip 2016/11/15 19:53:33 Here too, assert what the attributes should be, no
Raymond Toy 2016/11/15 22:07:42 Done.
83 .beEqualTo(true) && success;
84
85 success = Should("event.inputBuffer !== undefined", event.inputBuffer != = undefined)
86 .beEqualTo(true) && success;
87
88 success = Should("event.outputBuffer !== undefined", event.outputBuffer !== undefined)
89 .beEqualTo(true) && success;
90
91 Should("AudioProcessingEvent constructed", success)
92 .summarize("correctly",
93 "incorrectly");
94
95 taskDone();
96 });
97
98 audit.runTasks();
99 </script>
100 </body>
101 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698