|
36 | 36 | });
|
37 | 37 |
|
38 | 38 | recorderOnDataAvailable = test.step_func(event => {
|
39 |
| - // TODO(mcasas): ondataavailable might never be pinged with an empty Blob |
40 |
| - // data on recorder.stop(), see http://crbug.com/54428 |
41 | 39 | assert_equals(recorder.state, "inactive");
|
42 |
| - assert_equals(event.data.size, 0, 'We should have gotten an empty Blob'); |
| 40 | + assert_not_equals(event.data.size, 0, 'We should get a Blob with data'); |
43 | 41 | });
|
44 | 42 |
|
45 | 43 | recorderOnStop = test.step_func(function() {
|
46 | 44 | assert_equals(recorder.state, "inactive");
|
47 |
| - assert_throws("InvalidStateError", function() { recorder.stop() }, |
48 |
| - "recorder cannot be stop()ped in |inactive| state"); |
| 45 | + recorder.onstop = recorderOnUnexpectedEvent; |
| 46 | + recorder.stop(); |
| 47 | + assert_equals(recorder.state, "inactive", "stop() is idempotent"); |
49 | 48 | assert_throws("InvalidStateError", function() { recorder.pause() },
|
50 | 49 | "recorder cannot be pause()ed in |inactive| state");
|
51 | 50 | assert_throws("InvalidStateError", function() { recorder.resume() },
|
52 | 51 | "recorder cannot be resume()d in |inactive| state");
|
53 | 52 | assert_throws("InvalidStateError", function() { recorder.requestData() },
|
54 | 53 | "cannot requestData() if recorder is in |inactive| state");
|
55 |
| - recorder.onstop = recorderOnUnexpectedEvent; |
56 | 54 | test.done();
|
57 | 55 | });
|
58 | 56 |
|
|
91 | 89 | let recorder = new MediaRecorder(stream);
|
92 | 90 | assert_equals(recorder.state, "inactive");
|
93 | 91 |
|
94 |
| - assert_throws("InvalidStateError", function(){recorder.stop()}, |
95 |
| - "recorder cannot be stop()ped in |inactive| state"); |
| 92 | + recorder.stop(); |
| 93 | + assert_equals(recorder.state, "inactive", "stop() is idempotent"); |
96 | 94 | assert_throws("InvalidStateError", function(){recorder.pause()},
|
97 | 95 | "recorder cannot be pause()ed in |inactive| state");
|
98 | 96 | assert_throws("InvalidStateError", function(){recorder.resume()},
|
|
0 commit comments