Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html

Issue 2286833002: Convert RTCIceCandidate.html from js-test to testharness.js (Closed)
Patch Set: Change from 2 to 4 space indentation to match Chromium style Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
5 </head> 6 </head>
6 <body> 7 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script> 8 <script>
10 description("Tests RTCIceCandidate."); 9 function getInitializer() {
10 return {
11 candidate: 'foo',
12 sdpMid:'bar',
13 sdpMLineIndex: 6
14 };
15 }
11 16
12 var initializer = {candidate:"foo", sdpMid:"bar", sdpMLineIndex:6}; 17 test(function() {
13 var candidate; 18 let candidate = new RTCIceCandidate(getInitializer());
14 shouldNotThrow('candidate = new RTCIceCandidate(initializer);'); 19 assert_equals(candidate.candidate, 'foo');
15 shouldBeEqualToString('candidate.candidate', 'foo'); 20 assert_equals(candidate.sdpMid, 'bar');
16 shouldBeEqualToString('candidate.sdpMid', 'bar'); 21 assert_equals(candidate.sdpMLineIndex, 6);
17 shouldBe('candidate.sdpMLineIndex', '6');
18 22
19 shouldNotThrow('initializer = JSON.parse(JSON.stringify(candidate));'); 23 const initializer = JSON.parse(JSON.stringify(candidate));
24 candidate = new RTCIceCandidate(initializer);
25 assert_equals(candidate.candidate, 'foo');
26 assert_equals(candidate.sdpMid, 'bar');
27 assert_equals(candidate.sdpMLineIndex, 6);
28 }, 'Constructor can be initialized with output from another constructor');
20 29
21 shouldNotThrow('candidate = new RTCIceCandidate(initializer);'); 30 test(function() {
22 shouldBeEqualToString('candidate.candidate', 'foo'); 31 assert_throws('TypeMismatchError', () => new RTCIceCandidate({}));
23 shouldBeEqualToString('candidate.sdpMid', 'bar'); 32 assert_throws({name: 'TypeError'}, () => new RTCIceCandidate(5));
24 shouldBe('candidate.sdpMLineIndex', '6'); 33 assert_throws({name: 'TypeError'}, () => new RTCIceCandidate('foobar'));
34 assert_throws('TypeMismatchError', () => new RTCIceCandidate({candidate: ''} ));
35 }, 'Constructor throws on invalid input');
25 36
26 shouldThrow('new RTCIceCandidate({});'); 37 test(function() {
27 shouldThrow('new RTCIceCandidate(5);'); 38 new RTCIceCandidate({candidate: 'x'})
28 shouldThrow('new RTCIceCandidate("foobar");'); 39 }, 'Constructor does not throw on valid input');
29 shouldThrow('new RTCIceCandidate({candidate:""});');
30 40
31 shouldNotThrow('new RTCIceCandidate({candidate:"x"});'); 41 test(function() {
42 const candidate = new RTCIceCandidate(getInitializer());
43 candidate.candidate = 'bar';
44 candidate.sdpMid = 'foo';
45 candidate.sdpMLineIndex = 0;
46 assert_equals(candidate.candidate, 'bar');
47 assert_equals(candidate.sdpMid, 'foo');
48 assert_equals(candidate.sdpMLineIndex, 0);
32 49
33 candidate = new RTCIceCandidate(initializer); 50 candidate.candidate = null;
34 candidate.candidate = "bar"; 51 candidate.sdpMid = null;
35 candidate.sdpMid = "foo"; 52 assert_equals(candidate.candidate, 'null');
36 candidate.sdpMLineIndex = 0; 53 assert_equals(candidate.sdpMid, 'null');
37 shouldBeEqualToString('candidate.candidate', 'bar'); 54 }, 'candidate, sdpMid, and sdpMLineIndex properties can be modified');
38 shouldBeEqualToString('candidate.sdpMid', 'foo');
39 shouldBe('candidate.sdpMLineIndex', '0');
40
41 candidate.candidate = null;
42 candidate.sdpMid = null;
43 shouldBeEqualToString('candidate.candidate', 'null');
44 shouldBeEqualToString('candidate.sdpMid', 'null');
45
46 window.successfullyParsed = true;
47 </script> 55 </script>
48 </body> 56 </body>
49 </html> 57 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698