Index: third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html |
diff --git a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html |
index 0e4bfb3598b7cee3d8ebc22e706a9bbe71c29acf..0ac5c66ea1a3b509e5c9c3f0959a19390dbd75bc 100644 |
--- a/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html |
+++ b/third_party/WebKit/LayoutTests/webaudio/AudioBufferSource/audiobuffersource-channels.html |
@@ -30,9 +30,39 @@ |
source.buffer = 57; |
}, 'source.buffer = 57').throw('TypeError'); |
+ // It's ok to set the buffer to null. |
should(function() { |
source.buffer = null; |
- }, 'source.buffer = null').throw('TypeError'); |
+ }, 'source.buffer = null').notThrow(); |
+ |
+ // Set the buffer to a valid AudioBuffer |
+ let buffer = |
+ new AudioBuffer({length: 128, sampleRate: context.sampleRate}); |
+ |
+ should(function() { |
hongchan
2017/07/28 18:45:32
We prefer |()=>| over |function()|.
Raymond Toy
2017/07/28 19:16:55
I was fallowing the existing code which was using
|
+ source.buffer = buffer; |
+ }, 'source.buffer = buffer').notThrow(); |
+ |
+ // The buffer has been set; we can't set it again. |
+ should(function() { |
+ source.buffer = |
+ new AudioBuffer({length: 128, sampleRate: context.sampleRate}) |
+ }, 'source.buffer = new buffer').throw('InvalidStateError'); |
+ |
+ // The buffer has been set; it's ok to set it to null. |
+ should(function() { |
+ source.buffer = null; |
+ }, 'source.buffer = null again').notThrow(); |
+ |
+ // The buffer was already set (and set to null). Can't set it |
+ // again. |
+ should(function() { |
+ source.buffer = buffer; |
+ }, 'source.buffer = buffer again').throw('InvalidStateError'); |
+ |
+ // But setting to null is ok. |
+ should(function() { |
+ }, 'source.buffer = null after setting to null').notThrow(); |
// Check that mono buffer can be set. |
should(function() { |