Changeset 198325 in webkit
- Timestamp:
- Mar 17, 2016 3:52:20 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r198324 r198325 1 2016-03-17 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Update RTCIceCandidate 4 https://bugs.webkit.org/show_bug.cgi?id=155535 5 6 Reviewed by Eric Carlson. 7 8 RTCIceCandidate.html is updated to test the new construction behavior and the nullable 9 attributes. The remaining updated tests simply construct an RTCIceCandidate to be used for 10 test purposes. 11 12 * fast/mediastream/RTCIceCandidate-expected.txt: 13 * fast/mediastream/RTCIceCandidate.html: 14 * fast/mediastream/RTCPeerConnection-closed-state.html: 15 * fast/mediastream/RTCPeerConnection-overloaded-operations-expected.txt: 16 * fast/mediastream/RTCPeerConnection-overloaded-operations-params-expected.txt: 17 * fast/mediastream/RTCPeerConnection-overloaded-operations-params.html: 18 * fast/mediastream/RTCPeerConnection-overloaded-operations.html: 19 1 20 2016-03-17 Skachkov Oleksandr <gskachkov@gmail.com> 2 21 -
trunk/LayoutTests/fast/mediastream/RTCIceCandidate-expected.txt
r164941 r198325 8 8 PASS candidate.sdpMid is "bar" 9 9 PASS candidate.sdpMLineIndex is 6 10 PASS new RTCIceCandidate({}); did not throw exception. 11 PASS new RTCIceCandidate({candidate:"foo"}); did not throw exception. 12 PASS new RTCIceCandidate({sdpMid:"bar"}); did not throw exception. 13 PASS new RTCIceCandidate({sdpMLineIndex:6}); did not throw exception. 14 PASS new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 15 PASS new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 16 PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 17 PASS new RTCIceCandidate({sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 18 PASS new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 19 PASS new RTCIceCandidate({candidate:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 20 PASS new RTCIceCandidate({candidate:"", sdpMid:"bar"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 21 PASS new RTCIceCandidate({candidate:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 22 PASS new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 23 PASS new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 24 PASS new RTCIceCandidate({candidate:"foo", sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 25 PASS new RTCIceCandidate({sdpMid:""}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 26 PASS new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"}); threw exception TypeError: Invalid RTCIceCandidate constructor arguments. 10 11 Dictionary member 'candidate' is required. 12 PASS new RTCIceCandidate({}); threw exception TypeError: Error creating RTCIceCandidate. 13 PASS new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:6}); threw exception TypeError: Error creating RTCIceCandidate. 14 PASS new RTCIceCandidate({sdpMid:"bar"}); threw exception TypeError: Error creating RTCIceCandidate. 15 PASS new RTCIceCandidate({sdpMLineIndex:6}); threw exception TypeError: Error creating RTCIceCandidate. 16 17 One of the 'sdpMid' or 'sdpMLineIndex' members must be present. 18 PASS new RTCIceCandidate({candidate:"foo"}); threw exception TypeError: Error creating RTCIceCandidate. 19 20 When one of the 'sdpMid' or 'sdpMLineIndex' members is set, the other must be null. 21 PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid:"bar"}); did not throw exception. 22 PASS candidate.sdpMid is "bar" 23 PASS candidate.sdpMLineIndex is null 24 PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMLineIndex:6}); did not throw exception. 25 PASS candidate.sdpMid is null 26 PASS candidate.sdpMLineIndex is 6 27 28 Some bad input 29 PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"}); threw exception TypeError: Error creating RTCIceCandidate. 30 PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:-1}); threw exception TypeError: Error creating RTCIceCandidate. 31 PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex:65536}); threw exception TypeError: Error creating RTCIceCandidate. 27 32 PASS new RTCIceCandidate(5); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary. 28 33 PASS new RTCIceCandidate("foobar"); threw exception TypeError: Optional RTCIceCandidate constructor argument must be a valid Dictionary. -
trunk/LayoutTests/fast/mediastream/RTCIceCandidate.html
r164941 r198325 5 5 </head> 6 6 <body> 7 <p id="description"></p>8 <div id="console"></div>9 7 <script> 10 8 description("Tests RTCIceCandidate."); … … 16 14 shouldBe('candidate.sdpMid', '"bar"'); 17 15 shouldBe('candidate.sdpMLineIndex', '6'); 16 debug(""); 18 17 19 shouldNotThrow('new RTCIceCandidate({});'); 20 shouldNotThrow('new RTCIceCandidate({candidate:"foo"});'); 21 shouldNotThrow('new RTCIceCandidate({sdpMid:"bar"});'); 22 shouldNotThrow('new RTCIceCandidate({sdpMLineIndex:6});'); 18 debug("Dictionary member 'candidate' is required."); 19 shouldThrow('new RTCIceCandidate({});'); 20 shouldThrow('new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:6});'); 21 shouldThrow('new RTCIceCandidate({sdpMid:"bar"});'); 22 shouldThrow('new RTCIceCandidate({sdpMLineIndex:6});'); 23 debug(""); 23 24 24 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"bar", sdpMLineIndex:"a"});'); 25 shouldThrow('new RTCIceCandidate({sdpMid:"bar", sdpMLineIndex:"a"});'); 25 debug("One of the 'sdpMid' or 'sdpMLineIndex' members must be present."); 26 shouldThrow('new RTCIceCandidate({candidate:"foo"});'); 27 debug(""); 28 29 debug("When one of the 'sdpMid' or 'sdpMLineIndex' members is set, the other must be null."); 30 shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMid:"bar"});'); 31 shouldBe('candidate.sdpMid', '"bar"'); 32 shouldBe('candidate.sdpMLineIndex', 'null'); 33 shouldNotThrow('candidate = new RTCIceCandidate({candidate:"foo", sdpMLineIndex:6});'); 34 shouldBe('candidate.sdpMid', 'null'); 35 shouldBe('candidate.sdpMLineIndex', '6'); 36 debug(""); 37 38 debug("Some bad input"); 26 39 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"});'); 27 shouldThrow('new RTCIceCandidate({sdpMLineIndex:"a"});'); 28 29 shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar", sdpMLineIndex:6});'); 30 shouldThrow('new RTCIceCandidate({candidate:"", sdpMLineIndex:6});'); 31 shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"bar"});'); 32 shouldThrow('new RTCIceCandidate({candidate:""});'); 33 34 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:"", sdpMLineIndex:6});'); 35 shouldThrow('new RTCIceCandidate({sdpMid:"", sdpMLineIndex:6});'); 36 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMid:""});'); 37 shouldThrow('new RTCIceCandidate({sdpMid:""});'); 38 39 shouldThrow('new RTCIceCandidate({candidate:"", sdpMid:"", sdpMLineIndex:"a"});'); 40 40 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex:-1});'); 41 shouldThrow('new RTCIceCandidate({candidate:"foo", sdpMLineIndex:65536});'); 41 42 shouldThrow('new RTCIceCandidate(5);'); 42 43 shouldThrow('new RTCIceCandidate("foobar");'); -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-closed-state.html
r194112 r198325 23 23 24 24 var desc = new RTCSessionDescription({ "type": "offer" }); 25 var candidate = new RTCIceCandidate({ " sdpMLineIndex": 0 });25 var candidate = new RTCIceCandidate({ "candidate": "foo", "sdpMLineIndex": 0 }); 26 26 27 27 navigator.mediaDevices.getUserMedia({ "video": true }).then(function (s) { -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-overloaded-operations-expected.txt
r192575 r198325 30 30 PASS result = pc.setRemoteDescription(desc, emptyFunc, emptyFunc) did not throw exception. 31 31 PASS result is undefined. 32 PASS candidate = new RTCIceCandidate({}); did not throw exception.33 32 PASS result = pc.addIceCandidate(candidate) did not throw exception. 34 33 PASS result is an instance of Promise -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-overloaded-operations-params-expected.txt
r192575 r198325 80 80 PASS pc.setRemoteDescription(1, emptyFunc, emptyFunc) threw exception TypeError: Argument 1 ('description') to RTCPeerConnection.setRemoteDescription must be an instance of RTCSessionDescription. 81 81 82 PASS candidate = new RTCIceCandidate({}); did not throw exception.83 82 PASS pc.addIceCandidate(candidate) did not throw exception. 84 83 PASS pc.addIceCandidate(candidate, emptyFunc, emptyFunc) did not throw exception. -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-overloaded-operations-params.html
r192575 r198325 82 82 83 83 // Test addIceCandidate() 84 shouldNotThrow("candidate = new RTCIceCandidate({});");84 candidate = new RTCIceCandidate({ "candidate": "foo", "sdpMid": "bar" }); 85 85 86 86 shouldNotThrow("pc.addIceCandidate(candidate)"); -
trunk/LayoutTests/fast/mediastream/RTCPeerConnection-overloaded-operations.html
r192575 r198325 48 48 49 49 // Test addIceCandidate() 50 shouldNotThrow("candidate = new RTCIceCandidate({});");50 candidate = new RTCIceCandidate({ "candidate": "foo", "sdpMid": "bar" }); 51 51 52 52 shouldNotThrow("result = pc.addIceCandidate(candidate)"); -
trunk/Source/WebCore/ChangeLog
r198316 r198325 1 2016-03-17 Adam Bergkvist <adam.bergkvist@ericsson.com> 2 3 WebRTC: Update RTCIceCandidate 4 https://bugs.webkit.org/show_bug.cgi?id=155535 5 6 Reviewed by Eric Carlson. 7 8 Update the RTCIceCandidate constructor procedure to match the WebRTC 1.0 specification [1]. 9 In short: The "candidate" init dictionary member is required. At least one of the dictionary 10 members "sdpMid" and "sdpMLine" needs to be present; the corresponding attribute of the 11 other, is initialized to null. 12 13 [1] https://w3c.github.io/webrtc-pc/archives/20160215/webrtc.html 14 15 Tests: Updated fast/mediastream/RTCIceCandidate.htm 16 17 * Modules/mediastream/RTCIceCandidate.cpp: 18 (WebCore::RTCIceCandidate::create): 19 (WebCore::RTCIceCandidate::RTCIceCandidate): 20 * Modules/mediastream/RTCIceCandidate.h: 21 (WebCore::RTCIceCandidate::sdpMLineIndex): 22 (WebCore::RTCIceCandidate::setSdpMLineIndex): 23 * Modules/mediastream/RTCIceCandidate.idl: 24 * bindings/js/JSRTCIceCandidateCustom.cpp: 25 (WebCore::JSRTCIceCandidate::sdpMid): 26 (WebCore::JSRTCIceCandidate::sdpMLineIndex): 27 1 28 2016-03-16 Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> 2 29 -
trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.cpp
r192464 r198325 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 4 * Copyright (C) 2015 Ericsson AB. All rights reserved.4 * Copyright (C) 2015, 2016 Ericsson AB. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 45 45 { 46 46 String candidate; 47 bool ok = dictionary.get("candidate", candidate); 48 if (ok && candidate.isEmpty()) { 49 ec = TYPE_MISMATCH_ERR; 47 if (!dictionary.get("candidate", candidate)) { 48 ec = TypeError; 50 49 return nullptr; 51 50 } 52 51 53 52 String sdpMid; 54 ok = dictionary.get("sdpMid", sdpMid); 55 if (ok && sdpMid.isEmpty()) { 56 ec = TYPE_MISMATCH_ERR; 57 return nullptr; 53 dictionary.get("sdpMid", sdpMid); 54 55 Optional<unsigned short> sdpMLineIndex; 56 String sdpMLineIndexString; 57 58 if (dictionary.get("sdpMLineIndex", sdpMLineIndexString)) { 59 bool intConversionOk; 60 unsigned result = sdpMLineIndexString.toUIntStrict(&intConversionOk); 61 if (!intConversionOk || result > USHRT_MAX) { 62 ec = TypeError; 63 return nullptr; 64 } 65 sdpMLineIndex = result; 58 66 } 59 67 60 String tempLineIndex; 61 unsigned short sdpMLineIndex = 0; 62 // First we check if the property exists in the Dictionary. 63 ok = dictionary.get("sdpMLineIndex", tempLineIndex); 64 // Then we try to convert it to a number and check if it was successful. 65 if (ok) { 66 bool intConversionOk; 67 sdpMLineIndex = tempLineIndex.toUIntStrict(&intConversionOk); 68 if (!intConversionOk) { 69 ec = TYPE_MISMATCH_ERR; 70 return nullptr; 71 } 68 if (sdpMid.isNull() && !sdpMLineIndex) { 69 ec = TypeError; 70 return nullptr; 72 71 } 73 72 … … 75 74 } 76 75 77 Ref<RTCIceCandidate> RTCIceCandidate::create(const String& candidate, const String& sdpMid, unsigned shortsdpMLineIndex)76 Ref<RTCIceCandidate> RTCIceCandidate::create(const String& candidate, const String& sdpMid, Optional<unsigned short> sdpMLineIndex) 78 77 { 79 78 return adoptRef(*new RTCIceCandidate(candidate, sdpMid, sdpMLineIndex)); 80 79 } 81 80 82 RTCIceCandidate::RTCIceCandidate(const String& candidate, const String& sdpMid, unsigned shortsdpMLineIndex)81 RTCIceCandidate::RTCIceCandidate(const String& candidate, const String& sdpMid, Optional<unsigned short> sdpMLineIndex) 83 82 : m_candidate(candidate) 84 83 , m_sdpMid(sdpMid) -
trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.h
r192464 r198325 36 36 #include "ExceptionBase.h" 37 37 #include "ScriptWrappable.h" 38 #include <wtf/Optional.h> 38 39 #include <wtf/RefCounted.h> 39 40 #include <wtf/RefPtr.h> … … 48 49 public: 49 50 static RefPtr<RTCIceCandidate> create(const Dictionary&, ExceptionCode&); 50 static Ref<RTCIceCandidate> create(const String& candidate, const String& sdpMid, unsigned shortsdpMLineIndex);51 static Ref<RTCIceCandidate> create(const String& candidate, const String& sdpMid, Optional<unsigned short> sdpMLineIndex); 51 52 virtual ~RTCIceCandidate() { } 52 53 … … 57 58 void setSdpMid(const String& sdpMid) { m_sdpMid = sdpMid; } 58 59 59 unsigned shortsdpMLineIndex() const { return m_sdpMLineIndex; }60 void setSdpMLineIndex( unsigned shortsdpMLineIndex) { m_sdpMLineIndex = sdpMLineIndex; }60 Optional<unsigned short> sdpMLineIndex() const { return m_sdpMLineIndex; } 61 void setSdpMLineIndex(Optional<unsigned short> sdpMLineIndex) { m_sdpMLineIndex = sdpMLineIndex; } 61 62 62 63 private: 63 explicit RTCIceCandidate(const String& candidate, const String& sdpMid, unsigned shortsdpMLineIndex);64 explicit RTCIceCandidate(const String& candidate, const String& sdpMid, Optional<unsigned short> sdpMLineIndex); 64 65 65 66 String m_candidate; 66 67 String m_sdpMid; 67 unsigned shortm_sdpMLineIndex;68 Optional<unsigned short> m_sdpMLineIndex; 68 69 }; 69 70 -
trunk/Source/WebCore/Modules/mediastream/RTCIceCandidate.idl
r192464 r198325 36 36 ] interface RTCIceCandidate { 37 37 attribute DOMString candidate; 38 attribute DOMString sdpMid;39 attribute unsigned short sdpMLineIndex;38 [CustomGetter] attribute DOMString sdpMid; 39 [CustomGetter] attribute unsigned short sdpMLineIndex; 40 40 }; 41 41 -
trunk/Source/WebCore/bindings/js/JSRTCIceCandidateCustom.cpp
r170167 r198325 1 1 /* 2 2 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 * Copyright (C) 2016 Ericsson AB. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 66 67 } 67 68 69 JSValue JSRTCIceCandidate::sdpMid(ExecState& state) const 70 { 71 return jsOwnedStringOrNull(&state, wrapped().sdpMid()); 72 } 73 74 JSValue JSRTCIceCandidate::sdpMLineIndex(ExecState&) const 75 { 76 Optional<unsigned short> index = wrapped().sdpMLineIndex(); 77 return index ? JSValue(index.value()) : jsNull(); 78 } 79 68 80 } // namespace WebCore 69 81
Note: See TracChangeset
for help on using the changeset viewer.