REGRESSION: fast/events/touch/ios/long-press-on-image.html is failing
[WebKit-https.git] / LayoutTests / fast / events / touch / ios / long-press-on-image.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2 <meta charset="utf-8">
3
4 <html>
5 <head>
6     <script>
7         if (window.testRunner) {
8             testRunner.dumpAsText();
9             testRunner.waitUntilDone();
10         }
11
12         function getUIScript()
13         {
14             return `
15             (function() {
16                 uiController.longPressAtPoint(30, 20, function() {
17                     uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('contextMenu')));
18                 });
19              })();`
20         }
21
22         function runTest()
23         {
24             if (!testRunner.runUIScript)
25                 return;
26
27             var target = document.getElementById('target');
28             if (testRunner.runUIScript) {
29                 testRunner.runUIScript(getUIScript(), function(result) {
30                     var results = JSON.parse(result).contextMenu;
31                     var output = '';
32                     if (results.imageURL.includes("dice.png") && results.isImage && !results.isLink)
33                         output += 'PASS: context menu triggered on image';
34                     else
35                         output += 'FAIL: context menu was not triggered on image';
36
37                     document.getElementById('target').innerHTML = output;
38                     testRunner.notifyDone();
39                 });
40             }
41         }
42
43         window.addEventListener('load', runTest, false);
44     </script>
45     <style>
46         #target {
47             height: 100px;
48             width: 200px;
49             background-color: silver;
50         }
51     </style>
52     <meta name="viewport" content="initial-scale=1">
53 </head>
54 <body>
55 <div id="target">
56     <img src="../../../images/resources/dice.png" width="320" height="240" alt="Dice">
57     This test requires UIScriptController to run.
58 </div>
59 </body>
60 </html>