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

Side by Side Diff: LayoutTests/media/activation-behavior.html

Issue 208483002: Implement the activation behavior of media elements (click to play/pause) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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>activation behavior</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script>
6 <div id="log"></div>
7 <script>
8 function activation_behavior_test(tagName, src)
9 {
10 async_test(function(t)
11 {
12 var e = document.createElement(tagName);
13 e.controls = true;
14 e.src = src;
15 e.preload = 'auto';
16 e.oncanplay = t.step_func(function()
17 {
18 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState');
19 e.controller = new MediaController();
20 assert_false(e.controller.paused, 'controller paused state before cl ick');
21 assert_true(e.paused, 'element paused state before click');
22 e.click();
23 assert_false(e.controller.paused, 'controller paused state after cli ck');
24 assert_false(e.paused, 'element paused state after click');
25 t.done();
26 });
27 }, tagName + ' activation behavior for restrained media controller');
28
29 test(function()
30 {
31 var e = document.createElement(tagName);
32 e.controls = true;
33 e.controller = new MediaController();
34 e.controller.pause();
35 assert_true(e.controller.paused, 'controller paused state before click') ;
36 assert_true(e.paused, 'element paused state before click');
37 e.click();
38 assert_false(e.controller.paused, 'controller paused state after click') ;
39 assert_true(e.paused, 'element paused state after click');
40 }, tagName + ' activation behavior for paused media controller');
41
42 test(function()
43 {
44 var e = document.createElement(tagName);
45 e.controls = true;
46 e.controller = new MediaController();
47 e.controller.play();
48 assert_false(e.controller.paused, 'controller paused state before click' );
49 assert_false(e.paused, 'element paused state before click');
50 e.click();
51 assert_true(e.controller.paused, 'controller paused state after click');
52 assert_false(e.paused, 'element paused state after click');
acolwell GONE FROM CHROMIUM 2014/03/21 23:30:12 This is really weird. I'm surprised that calling p
philipj_slow 2014/03/23 03:42:49 MediaController is non-trivial, I was surprised as
53 }, tagName + ' activation behavior for playing media controller');
54
55 test(function()
56 {
57 var e = document.createElement(tagName);
58 e.controls = true;
59 assert_true(e.paused, 'paused state before click()');
60 e.click();
61 assert_false(e.paused, 'paused state after click()');
62 }, tagName + ' activation behavior for paused media element');
63
64 test(function()
65 {
66 var e = document.createElement(tagName);
67 e.controls = true;
68 e.play();
69 assert_false(e.paused, 'paused state before click()');
70 e.click();
71 assert_true(e.paused, 'paused state after click()');
72 }, tagName + ' activation behavior for playing media element');
73
74 test(function()
75 {
76 var e = document.createElement(tagName);
77 e.controls = true;
78 e.onclick = function(ev) { ev.preventDefault(); };
79 assert_true(e.paused, 'paused state before click()');
80 e.click();
81 assert_true(e.paused, 'paused state after click()');
82 }, tagName + ' activation behavior for canceled event');
83
84 test(function()
85 {
86 var e = document.createElement(tagName);
87 assert_true(e.paused, 'paused state before click()');
88 e.click();
89 assert_true(e.paused, 'paused state after click()');
90 }, tagName + ' activation behavior without controls');
91 }
92
93 activation_behavior_test('audio', findMediaFile('audio', 'content/test'));
94 activation_behavior_test('video', findMediaFile('video', 'content/test'));
95 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/activation-behavior-accesskey.html » ('j') | Source/core/html/HTMLMediaElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698