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

Unified 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, 4 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b0ff98b3d40ae30e73048fc9e6bd7e2aa90c6747 100644
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html
+++ b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCIceCandidate.html
@@ -1,49 +1,57 @@
<!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);
+}, 'Constructor can be initialized with output from another constructor');
+
+test(function() {
+ assert_throws('TypeMismatchError', () => new RTCIceCandidate({}));
+ assert_throws({name: 'TypeError'}, () => new RTCIceCandidate(5));
+ assert_throws({name: 'TypeError'}, () => new RTCIceCandidate('foobar'));
+ assert_throws('TypeMismatchError', () => new RTCIceCandidate({candidate: ''}));
+}, 'Constructor throws on invalid input');
+
+test(function() {
+ new RTCIceCandidate({candidate: 'x'})
+}, 'Constructor does not throw on valid input');
+
+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');
+}, 'candidate, sdpMid, and sdpMLineIndex properties can be modified');
</script>
</body>
</html>
« 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