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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document.html

Issue 2246223004: Convert fast/events media tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/fast/events/media-focus-in-standalone-media-document-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>This tests that media element in a standalone media document cannot be f ocused directly using focus() method or by mouse click.</title>
3 <head> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../media/media-file.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script src="../../media/media-file.js"></script>
6 (Please avoid writing new tests using video-test.js) --> 6 <iframe width="380" height="330"></iframe>
7 <script src="../../media/video-test.js"></script> 7 <script>
8 <script type="text/javascript"> 8 async_test(function(t) {
9 var videoElement; 9 var iframe = document.querySelector("iframe");
10 var standaloneMediaDocument; 10 iframe.src = "../../media/" + findMediaFile("video", "content/test");
11 var skipOnFirstEmptyLoad = 0;
12 11
13 function frameLoaded() 12 iframe.onload = t.step_func(function() {
14 { 13 var standaloneMediaDocument = iframe.contentDocument;
15 if (++skipOnFirstEmptyLoad == 1) 14 var video = standaloneMediaDocument.querySelector("video");
16 return;
17 15
18 standaloneMediaDocument = document.getElementById("videoframe"). contentDocument; 16 video.onclick = t.step_func_done(function() {
19 videoElement = standaloneMediaDocument.querySelector("video"); 17 // Should not focus video element by mouse click.
18 assert_not_equals(standaloneMediaDocument.activeElement, video);
19 });
20 20
21 videoElement.addEventListener('click',function(){ 21 // Should not focus video element by calling focus() method.
22 consoleWrite("*** Video element clicked."); 22 video.focus();
23 },false); 23 assert_not_equals(standaloneMediaDocument.activeElement, video);
24 24
25 testFocus(); 25 // Simulate click event to try focus video element.
26 testFocusbyMouseClick(); 26 var click = document.createEvent("MouseEvents");
27 consoleWrite(""); 27 click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, document);
fs 2016/08/17 14:29:49 Maybe replace these two lines with a "new MouseEve
Srirama 2016/08/17 14:45:53 Done.
28 endTest(); 28 video.dispatchEvent(click);
29 } 29 });
30 30 });
31 function testFocus() 31 </script>
32 {
33 consoleWrite("<br>*** Should not focus video element by calling focus() method.");
34 videoElement.focus();
35 testExpected("standaloneMediaDocument.activeElement", videoEleme nt, "!=");
36 }
37
38 function testFocusbyMouseClick()
39 {
40 // Simulate click event to try focus video element.
41 consoleWrite("<br>*** Should not focus video element by mouse cl ick.");
42 var click = document.createEvent("MouseEvents");
43 click.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, document);
44 videoElement.dispatchEvent(click);
45 testExpected("standaloneMediaDocument.activeElement", videoEleme nt, "!=");
46 }
47 </script>
48 </head>
49 <body>
50 <p>
51 This tests that media element in a standalone media document cannot be focused directly using focus() method or by mouse click.
52 </p>
53 <iframe id="videoframe" width=380 height=330 onload="frameLoaded()"></if rame>
54 <script type="text/javascript">
55 document.getElementById("videoframe").src = "../../media/" + findMed iaFile("video", "content/test");
56 </script>
57 </body>
58 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/media-focus-in-standalone-media-document-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698