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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-invoke-in-sync-event.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <title>await a stable state and sync event handlers</title>
3 <script src="../../../../../../../resources/testharness.js"></script>
4 <script src="../../../../../../../resources/testharnessreport.js"></script>
5 <div id=log></div>
6 <video></video>
7 <script>
8 var v;
9 var t = async_test(function(t) {
10 v = document.querySelector('video');
11 var a = document.createElement('a');
12 a.onclick = t.step_func(function() {
13 v.setAttribute('src', '#'); // invokes media load which invokes resource sel ection
14 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState in onclick handler');
15 });
16 a.click(); // sync fires click, so sets src
17 // now we should still await a stable state because the script hasn't
18 // finished, the event handler has just returned
19 assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState after click() ');
20 v.removeAttribute('src');
21 });
22 </script>
23 <script>
24 t.step(function() {
25 // now the sync section of resource selection should have run and should
26 // have found no src="" or <source> thus networkState being set to NETWORK_EMP TY.
27 // if the sync section was run when onclick returned, then networkState
28 // would be either NETWORK_LOADING or NETWORK_NO_SOURCE.
29 assert_equals(v.networkState, v.NETWORK_EMPTY, 'networkState in separate scrip t');
30 t.done();
31 });
32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698