Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/track-word-breaking.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html b/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html |
| index 12fc37bd4617acfec95f25480827156eaa8a0a3d..f0cb2e907e40ba280d1c88b0150836d506b4f350 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/track-word-breaking.html |
| @@ -1,53 +1,35 @@ |
| -<html> |
| - <head> |
| - <script> |
| - if (window.internals.settings) |
| - { |
| - // This should not be necessary, but due to crbug.com/372245 style |
| - // gets dirtied during layout in LayoutTextTrackContainer which |
| - // causes assertions to fail when Document::scrollingElement is |
| - // queried during compositing update (a valid request). |
| - window.internals.settings.setCompositorWorkerEnabled(false); |
| - } |
| - </script> |
| - <script src=../media-file.js></script> |
| - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=../video-test.js></script> |
| - <script src=../media-controls.js></script> |
| - <script> |
| +<!DOCTYPE html> |
| +<title>Test that line breaks are forced in captions.</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../media-file.js"></script> |
| +<script src="../media-controls.js"></script> |
| +<script> |
| +// This should not be necessary, but due to crbug.com/372245 style |
| +// gets dirtied during layout in LayoutTextTrackContainer which |
| +// causes assertions to fail when Document::scrollingElement is |
| +// queried during compositing update (a valid request). |
| +window.internals.settings.setCompositorWorkerEnabled(false); |
| +</script> |
| +<video> |
| + <track src="captions-webvtt/long-word.vtt" kind="captions" default> |
| +</video> |
| +<script> |
| +async_test(function(t) { |
| + var singleLineRect; |
| + var video = document.querySelector("video"); |
| + video.oncanplaythrough = t.step_func(function() { |
| + // Record Single line caption height. |
| + singleLineRect = textTrackDisplayElement(video).firstChild.firstChild.getBoundingClientRect(); |
|
fs
2016/06/13 15:20:18
Maybe move the right-hand side (+ .height) here in
Srirama
2016/06/13 17:33:38
Done.
|
| + video.currentTime = 3; |
| + }); |
| - var singleLineRect; |
| + video.onseeked = t.step_func_done(function() { |
| + var multiLineRect = textTrackDisplayElement(video).firstChild.firstChild.getBoundingClientRect(); |
| + var ratio = multiLineRect.height / singleLineRect.height; |
| + assert_greater_than(ratio, 2); |
| + }); |
| - function testUnbreakableLine() |
| - { |
| - var multiLineRect = textTrackDisplayElement(video).firstChild.firstChild.getBoundingClientRect(); |
| - var ratio = multiLineRect.height / singleLineRect.height; |
| - logResult(ratio > 2, "Second caption was more than twice as tall as first caption.") |
| - endTest(); |
| - } |
| - |
| - function testSingleLine() |
| - { |
| - singleLineRect = textTrackDisplayElement(video).firstChild.firstChild.getBoundingClientRect(); |
| - consoleWrite("Single line caption height recorded."); |
| - video.currentTime = 3; |
| - } |
| - |
| - function loaded() |
| - { |
| - consoleWrite('Test that line breaks are forced in captions.'); |
| - findMediaElement(); |
| - waitForEvent('canplaythrough', testSingleLine); |
| - waitForEvent('seeked', testUnbreakableLine); |
| - video.src = findMediaFile('video', '../content/test'); |
| - } |
| - |
| - </script> |
| - </head> |
| - <body onload="loaded()"> |
| - <video controls > |
| - <track src="captions-webvtt/long-word.vtt" kind="captions" default> |
| - </video> |
| - </body> |
| -</html> |
| + video.src = findMediaFile("video", "../content/test"); |
| +}); |
| +</script> |