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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt_automation/fullscreen/auto-click.js

Issue 2466333002: Automate Fullscreen web-platform-tests using wpt_automation (Closed)
Patch Set: update line numbers Created 4 years, 1 month 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
OLDNEW
(Empty)
1 (function() {
2
3 function click(button) {
4 var rect = button.getBoundingClientRect();
5 eventSender.mouseMoveTo(rect.left, rect.top);
6 eventSender.mouseDown();
7 eventSender.mouseUp();
8 }
9
10 var observer = new MutationObserver(mutations => {
11 for (var mutation of mutations) {
12 for (var node of mutation.addedNodes) {
13 if (node.localName == 'button')
14 click(node);
15 else if (node.localName == 'iframe')
16 observe(node.contentDocument);
17 }
18 }
19 });
20
21 function observe(target) {
22 observer.observe(target, { childList: true, subtree: true });
23 }
24
25 // Handle what's already in the document.
26 for (var button of document.getElementsByTagName('button')) {
27 click(button);
28 }
29 for (var iframe of document.getElementsByTagName('iframe')) {
30 observe(iframe.contentDocument);
31 }
32
33 // Observe future changes.
34 observe(document);
35
36 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698