Chromium Code Reviews| Index: LayoutTests/media/track/opera/track/webvtt/parsing-cue-data/common.js |
| diff --git a/LayoutTests/media/track/opera/track/webvtt/parsing-cue-data/common.js b/LayoutTests/media/track/opera/track/webvtt/parsing-cue-data/common.js |
| index 543fe46556f8d9f0622b280439f581e44458742f..74dc4eae8fc9c0448a48aab013b429bba924c8c1 100644 |
| --- a/LayoutTests/media/track/opera/track/webvtt/parsing-cue-data/common.js |
| +++ b/LayoutTests/media/track/opera/track/webvtt/parsing-cue-data/common.js |
| @@ -109,6 +109,31 @@ function test_serializer(element) { |
| return lines.join("\n"); |
| } |
| +function mark_diffs(expected, actual) { |
| + var expected_lines = expected.split("\n"); |
| + var actual_lines = actual.split("\n"); |
| + |
| + var max_length = Math.max(expected_lines.length, actual_lines.length); |
| + |
| + var expected_diff = ["code", {}]; |
| + var actual_diff = ["code", {}]; |
| + |
| + for (var i=0; i<max_length; i++) { |
| + if (expected_lines[i] === actual_lines[i]) { |
| + expected_diff.push(expected_lines[i] + "\n"); |
| + actual_diff.push(actual_lines[i] + "\n"); |
| + } else { |
| + if (expected_lines[i]) { |
| + expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]); |
| + } |
| + if (actual_lines[i]) { |
| + actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]); |
| + } |
| + } |
| + } |
| + return [expected_diff, actual_diff]; |
| +} |
| + |
| function print_diffs(test_id, uri_encoded_input, expected, actual, container) { |
| container = container ? container : null; |
| if (actual) { |
| @@ -171,9 +196,11 @@ function trackLoaded(e) { |
| var cue = track.track.cues[0]; |
| var frag = cue.getCueAsHTML(); |
| var got = test_serializer(frag); |
| - if (got !== this.expected) { |
| - print_diffs(this.test_id, this.url_encoded_input, this.expected, got); |
| - } |
| + // For friendlier output on failures, expose the template.render() function from |
| + // testharness.js, and enable this block. |
| + // if (got !== this.expected) { |
|
jochen (gone - plz use gerrit)
2013/11/19 16:06:46
what about making this configurable by defining a
|
| + // print_diffs(this.test_id, this.url_encoded_input, this.expected, got); |
| + // } |
| assert_equals(got, this.expected); |
| this.done(); |
| } |