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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-helpers.js

Issue 2051233004: Convert track-webvtt-tc[024-026] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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/media/track/track-webvtt-tc024-timestamp.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function enableAllTextTracks(textTracks) { 1 function enableAllTextTracks(textTracks) {
2 for (var i = 0; i < textTracks.length; i++) { 2 for (var i = 0; i < textTracks.length; i++) {
3 var track = textTracks[i]; 3 var track = textTracks[i];
4 if (track.mode == "disabled") 4 if (track.mode == "disabled")
5 track.mode = "hidden"; 5 track.mode = "hidden";
6 } 6 }
7 } 7 }
8 8
9 function assert_cues_equal(cues, expected) { 9 function assert_cues_equal(cues, expected) {
10 assert_equals(cues.length, expected.length); 10 assert_equals(cues.length, expected.length);
(...skipping 27 matching lines...) Expand all
38 func(trackElement.track); 38 func(trackElement.track);
39 }); 39 });
40 }, "Check cues from " + src); 40 }, "Check cues from " + src);
41 } 41 }
42 42
43 function assert_cue_fragment(cue, children) { 43 function assert_cue_fragment(cue, children) {
44 var fragment = createFragment(children); 44 var fragment = createFragment(children);
45 assert_true(fragment.isEqualNode(cue.getCueAsHTML())); 45 assert_true(fragment.isEqualNode(cue.getCueAsHTML()));
46 } 46 }
47 47
48 function assert_cue_fragment_as_textcontent(cue, children) {
49 var fragment = createFragment(children);
50 assert_equals(cue.getCueAsHTML().textContent, fragment.textContent);
51 }
52
48 function createFragment(children) { 53 function createFragment(children) {
49 var fragment = document.createDocumentFragment(); 54 var fragment = document.createDocumentFragment();
50 cloneChildrenToFragment(fragment, children); 55 cloneChildrenToFragment(fragment, children);
51 return fragment; 56 return fragment;
52 } 57 }
53 58
54 function cloneChildrenToFragment(root, children) { 59 function cloneChildrenToFragment(root, children) {
55 for (var child of children) { 60 for (var child of children) {
56 var childElement; 61 var childElement;
57 if (child.type == "text") { 62 if (child.type == "text") {
58 childElement = document.createTextNode(child.value); 63 childElement = document.createTextNode(child.value);
64 } else if (child.type == "style") {
fs 2016/06/11 18:04:18 I was actually thinking more like: ... { type: "s
Srirama 2016/06/12 06:06:16 Done.
65 var style = child.value;
66 for (var attr of Object.getOwnPropertyNames(style))
67 root[attr] = style[attr];
59 } else { 68 } else {
60 childElement = document.createElement(child.type); 69 childElement = document.createElement(child.type);
61 cloneChildrenToFragment(childElement, child.value); 70 cloneChildrenToFragment(childElement, child.value);
62 } 71 }
63 root.appendChild(childElement); 72 root.appendChild(childElement);
64 } 73 }
65 } 74 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698