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

Unified Diff: third_party/WebKit/LayoutTests/media/video-move-to-new-document.html

Issue 2450853005: Don't invoke load algorithm when a media element is moved into a new document.
Patch Set: Created 4 years, 2 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/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/video-move-to-new-document.html
diff --git a/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html b/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html
index 139f7013c9252e850ef323e272add1fb75f073e1..2a02318aeb0cf16db82b8f3c03cee83f74889707 100644
--- a/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html
+++ b/third_party/WebKit/LayoutTests/media/video-move-to-new-document.html
@@ -3,32 +3,36 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-file.js"></script>
-<video></video>
-<iframe></iframe>
+<div id=container>
+ <iframe></iframe>
+</div>
<script>
- async_test(function(t) {
- var video = document.querySelector('video');
- video.src = findMediaFile("video", "content/test");
- video.onloadeddata = this.step_func(function() {
- video.onloadeddata = null;
- assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
- assert_greater_than(video.readyState, video.HAVE_METADATA);
- // Move the video element to iframe document from
- // main document and verify that it loads properly
- document.querySelector('iframe').contentDocument.body.appendChild(video);
- assert_equals(video.networkState, video.NETWORK_NO_SOURCE);
- assert_equals(video.readyState, video.HAVE_NOTHING);
- var actual_events = [];
- var expected_events = ['emptied', 'loadstart', 'loadeddata'];
- expected_events.forEach(function(type) {
- video.addEventListener(type, t.step_func(function() {
- actual_events.push(type);
- if (type == 'loadeddata') {
- assert_array_equals(actual_events, expected_events);
- t.done();
- }
- }));
- });
- });
- });
+ function whenIframeLoaded(iframe, callback) {
+ if (iframe.contentDocument.readyState != 'uninitialized')
+ return callback();
+ iframe.onload = callback;
+ }
+
+ async_test(function(t) {
+ var iframe = document.querySelector('iframe');
+ whenIframeLoaded(iframe, this.step_func(function() {
+ var video = iframe.contentDocument.createElement('video');
+ iframe.contentDocument.body.appendChild(video);
+ video.src = findMediaFile('video', 'content/test');//'https://storage.googleapis.com/dalecurtis-shared/buck2.mp4';
+ video.preload = 'auto';
+
+ video.onloadeddata = this.step_func_done(function() {
+ video.onloadeddata = null;
+ assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
+ assert_greater_than(video.readyState, video.HAVE_METADATA);
+
+ // Move the video element parent document. The state shouldn't change.
+ document.body.appendChild(video);
+ document.body.querySelector('#container').innerHTML = '';
+
+ assert_true(video.networkState == video.NETWORK_IDLE || video.networkState == video.NETWORK_LOADING);
+ assert_greater_than(video.readyState, video.HAVE_METADATA);
+ });
+ }));
+ });
</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698