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

Unified Diff: LayoutTests/media/activation-behavior.html

Issue 830183005: Re-enable the activation behavior of media elements (click to play/pause) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: simplify test Created 5 years, 11 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
Index: LayoutTests/media/activation-behavior.html
diff --git a/LayoutTests/media/activation-behavior.html b/LayoutTests/media/activation-behavior.html
new file mode 100644
index 0000000000000000000000000000000000000000..9dc3fb78d88649ee4981b91ca2cc44c0ac21c922
--- /dev/null
+++ b/LayoutTests/media/activation-behavior.html
@@ -0,0 +1,111 @@
+<!doctype html>
+<title>activation behavior</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+function activation_behavior_test(tagName)
+{
+ test(function()
+ {
+ var e1 = document.createElement(tagName);
+ var e2 = document.createElement(tagName);
+ e1.controls = true;
+ e1.play(); // plays and clears autoplaying flag
+ // e2 remains autoplaying and paused
+ e1.controller = new MediaController();
+ e2.controller = e1.controller;
+ assert_false(e1.controller.paused, 'controller paused state before click');
+ assert_false(e1.paused, 'element 1 paused state before click');
+ assert_true(e2.paused, 'element 2 paused state before click');
+ e1.click();
+ assert_false(e1.controller.paused, 'controller paused state after click');
+ assert_false(e1.paused, 'element 1 paused state after click');
+ assert_false(e2.paused, 'element 2 paused state after click');
+ }, tagName + ' activation behavior for restrained media controller (with autoplaying and paused slave)');
+
+ test(function()
+ {
+ var e1 = document.createElement(tagName);
+ var e2 = document.createElement(tagName);
+ e1.controls = true;
+ e1.pause(); // clears autoplaying flag
+ e2.pause(); // clears autoplaying flag
+ e1.controller = new MediaController();
+ e2.controller = e1.controller;
+ assert_false(e1.controller.paused, 'controller paused state before click');
+ assert_true(e1.paused, 'element 1 paused state before click');
+ assert_true(e2.paused, 'element 2 paused state before click');
+ e1.click();
+ assert_false(e1.controller.paused, 'controller paused state after click');
+ assert_false(e1.paused, 'element 1 paused state after click');
+ assert_false(e2.paused, 'element 2 paused state after click');
+ }, tagName + ' activation behavior for restrained media controller (with all paused slaves)');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ e.controls = true;
+ e.controller = new MediaController();
+ e.controller.pause();
+ assert_true(e.controller.paused, 'controller paused state before click');
+ assert_true(e.paused, 'element paused state before click');
+ e.click();
+ assert_false(e.controller.paused, 'controller paused state after click');
+ assert_true(e.paused, 'element paused state after click');
+ }, tagName + ' activation behavior for paused media controller');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ e.controls = true;
+ e.controller = new MediaController();
+ e.controller.play();
+ assert_false(e.controller.paused, 'controller paused state before click');
+ assert_false(e.paused, 'element paused state before click');
+ e.click();
+ assert_true(e.controller.paused, 'controller paused state after click');
+ assert_false(e.paused, 'element paused state after click');
+ }, tagName + ' activation behavior for playing media controller');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ e.controls = true;
+ assert_true(e.paused, 'paused state before click()');
+ e.click();
+ assert_false(e.paused, 'paused state after click()');
+ }, tagName + ' activation behavior for paused media element');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ e.controls = true;
+ e.play();
+ assert_false(e.paused, 'paused state before click()');
+ e.click();
+ assert_true(e.paused, 'paused state after click()');
+ }, tagName + ' activation behavior for playing media element');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ e.controls = true;
+ e.onclick = function(ev) { ev.preventDefault(); };
+ assert_true(e.paused, 'paused state before click()');
+ e.click();
+ assert_true(e.paused, 'paused state after click()');
+ }, tagName + ' activation behavior for canceled event');
+
+ test(function()
+ {
+ var e = document.createElement(tagName);
+ assert_true(e.paused, 'paused state before click()');
+ e.click();
+ assert_true(e.paused, 'paused state after click()');
+ }, tagName + ' activation behavior without controls');
+}
+
+activation_behavior_test('audio');
+activation_behavior_test('video');
+</script>
« no previous file with comments | « no previous file | LayoutTests/media/activation-behavior-accesskey.html » ('j') | LayoutTests/media/activation-behavior-shadow.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698