summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html')
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html
new file mode 100644
index 000000000..22dbebf12
--- /dev/null
+++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/large-videos-autoplaying-click-to-pause.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ video {
+ width: 480px;
+ height: 320px;
+ }
+ </style>
+ <script>
+ var isFirstClick = true;
+ function handleMouseDown() {
+ document.querySelector(isFirstClick ? "#first" : "#second").pause();
+ isFirstClick = false;
+ }
+
+ function handleFirstPause() {
+ setTimeout(function() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage("paused");
+ } catch(e) { }
+ }, 0);
+ }
+
+ function handleSecondPause() {
+ setTimeout(function() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage("paused");
+ } catch(e) { }
+ }, 0);
+ }
+
+ function beganAutoplaying() {
+ setTimeout(function() {
+ try {
+ window.webkit.messageHandlers.testHandler.postMessage("autoplayed");
+ } catch(e) {
+ }
+ }, 0)
+ }
+ </script>
+ </head>
+ <body onmousedown=handleMouseDown()>
+ <video autoplay onplaying=beganAutoplaying() loop id="first" src="large-video-with-audio.mp4" onpause=handleFirstPause()></video>
+ <video autoplay onplaying=beganAutoplaying() loop id="second" src="large-video-with-audio.mp4" onpause=handleSecondPause()></video>
+ </body>
+<html>