Commit de05c7c5 authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Commit Bot

Don't enforce name rule for RTCDTMFToneChangeEvent

Since the constructor of RTCDTMFToneChangeEvent is exposed,
creating such events with other names than "tonechange" is possible.
No reason to discriminate against such.

Also adds tests for constructor.

Bug: chromium:822799
Change-Id: I4b36f3094acee200dd4200c4d24f6b46e10a06e6
Reviewed-on: https://chromium-review.googlesource.com/992038Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547742}
parent 3d27f7fa
......@@ -10,5 +10,7 @@ PASS Calling insertDTMF() in the middle of tonechange events should cause future
PASS Calling insertDTMF() multiple times in the middle of tonechange events should cause future tonechanges to be updated the last provided tones
PASS Calling insertDTMF('') in the middle of tonechange events should stop future tonechange events from firing
FAIL Setting transceiver.currentDirection to recvonly in the middle of tonechange events should stop future tonechange events from firing pc.addTransceiver is not a function
PASS Tone change event constructor works
PASS Tone change event with unexpected name should not crash
Harness: the test ran to completion.
......@@ -282,4 +282,15 @@
}, `Setting transceiver.currentDirection to recvonly in the middle of tonechange events should stop future tonechange events from firing`);
/* Section 7.3 - Tone change event */
test(t => {
let ev = new RTCDTMFToneChangeEvent('tonechange', {'tone': '1'});
assert_equals(ev.type, 'tonechange');
assert_equals(ev.tone, '1');
}, 'Tone change event constructor works');
test(t => {
let ev = new RTCDTMFToneChangeEvent('worngname', {});
}, 'Tone change event with unexpected name should not crash');
</script>
......@@ -34,7 +34,6 @@ RTCDTMFToneChangeEvent* RTCDTMFToneChangeEvent::Create(const String& tone) {
RTCDTMFToneChangeEvent* RTCDTMFToneChangeEvent::Create(
const AtomicString& type,
const RTCDTMFToneChangeEventInit& initializer) {
DCHECK(type == EventTypeNames::tonechange);
return new RTCDTMFToneChangeEvent(initializer);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment