Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html |
| index be05c735bc73cdc924f66e1ebada233893fe1626..872b73c9038ad6cc0233401d7dbd4870058f7943 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html |
| +++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html |
| @@ -1,49 +1,55 @@ |
| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| -<script src="../../resources/js-test.js"></script> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| <script> |
| -description("Tests RTCIceCandidate."); |
| - |
| -var initializer = {candidate:"foo", sdpMid:"bar", sdpMLineIndex:6}; |
| -var candidate; |
| -shouldNotThrow('candidate = new RTCIceCandidate(initializer);'); |
| -shouldBeEqualToString('candidate.candidate', 'foo'); |
| -shouldBeEqualToString('candidate.sdpMid', 'bar'); |
| -shouldBe('candidate.sdpMLineIndex', '6'); |
| - |
| -shouldNotThrow('initializer = JSON.parse(JSON.stringify(candidate));'); |
| - |
| -shouldNotThrow('candidate = new RTCIceCandidate(initializer);'); |
| -shouldBeEqualToString('candidate.candidate', 'foo'); |
| -shouldBeEqualToString('candidate.sdpMid', 'bar'); |
| -shouldBe('candidate.sdpMLineIndex', '6'); |
| - |
| -shouldThrow('new RTCIceCandidate({});'); |
| -shouldThrow('new RTCIceCandidate(5);'); |
| -shouldThrow('new RTCIceCandidate("foobar");'); |
| -shouldThrow('new RTCIceCandidate({candidate:""});'); |
| - |
| -shouldNotThrow('new RTCIceCandidate({candidate:"x"});'); |
| - |
| -candidate = new RTCIceCandidate(initializer); |
| -candidate.candidate = "bar"; |
| -candidate.sdpMid = "foo"; |
| -candidate.sdpMLineIndex = 0; |
| -shouldBeEqualToString('candidate.candidate', 'bar'); |
| -shouldBeEqualToString('candidate.sdpMid', 'foo'); |
| -shouldBe('candidate.sdpMLineIndex', '0'); |
| - |
| -candidate.candidate = null; |
| -candidate.sdpMid = null; |
| -shouldBeEqualToString('candidate.candidate', 'null'); |
| -shouldBeEqualToString('candidate.sdpMid', 'null'); |
| - |
| -window.successfullyParsed = true; |
| +function getInitializer() { |
| + return { |
| + candidate: 'foo', |
| + sdpMid:'bar', |
| + sdpMLineIndex: 6 |
| + }; |
| +} |
| + |
| +test(function() { |
| + let candidate = new RTCIceCandidate(getInitializer()); |
| + assert_equals(candidate.candidate, 'foo'); |
| + assert_equals(candidate.sdpMid, 'bar'); |
| + assert_equals(candidate.sdpMLineIndex, 6); |
| + |
| + const initializer = JSON.parse(JSON.stringify(candidate)); |
| + candidate = new RTCIceCandidate(initializer); |
| + assert_equals(candidate.candidate, 'foo'); |
| + assert_equals(candidate.sdpMid, 'bar'); |
| + assert_equals(candidate.sdpMLineIndex, 6); |
| +}); |
| + |
| +assert_throws('TypeMismatchError', () => new RTCIceCandidate({})); |
|
qyearsley
2016/08/26 21:34:05
This is the first time I've seen ES6 arrow functio
|
| +assert_throws({name: 'TypeError'}, () => new RTCIceCandidate(5)); |
| +assert_throws({name: 'TypeError'}, () => new RTCIceCandidate('foobar')); |
| +assert_throws('TypeMismatchError', () => new RTCIceCandidate({candidate: ''})); |
|
qyearsley
2016/08/26 21:34:05
Should these asserts be inside of a function passe
|
| + |
| +test(() => new RTCIceCandidate({candidate: 'x'})); |
|
qyearsley
2016/08/26 21:34:05
To make it explicit that we're expecting no except
|
| + |
| +test(function() { |
| + const candidate = new RTCIceCandidate(getInitializer()); |
| + candidate.candidate = 'bar'; |
| + candidate.sdpMid = 'foo'; |
| + candidate.sdpMLineIndex = 0; |
| + assert_equals(candidate.candidate, 'bar'); |
| + assert_equals(candidate.sdpMid, 'foo'); |
| + assert_equals(candidate.sdpMLineIndex, 0); |
| + |
| + candidate.candidate = null; |
| + candidate.sdpMid = null; |
| + assert_equals(candidate.candidate, 'null'); |
| + assert_equals(candidate.sdpMid, 'null'); |
| +}); |
|
qyearsley
2016/08/26 21:34:05
Although, it wasn't in the original code, if we co
|
| </script> |
| </body> |
| </html> |