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> |