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

Side by Side Diff: chrome/test/data/fullscreen_keyboardlock/fullscreen_keyboardlock.html

Issue 2922773002: Add BrowserCommandController Interactive Test (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
msw 2017/06/06 20:32:07 Please find a good reviewer for test html/js, I'm
Hzj_jie 2017/06/28 00:34:44 Done.
2 <html>
3 <head>
4 <title>Fullscreen Keyboard Lock Test</title>
5 <script>
6 let done = false;
7 function report() {
8 return new Promise((resolve, reject) => {
9 let register = () => {
10 window.setTimeout(() => {
11 if (done) {
12 resolve();
13 } else {
14 register();
15 }
16 }, 100);
17 };
18 register();
19 }).then(() => {
20 window.domAutomationController.send(container().innerHTML);
21 });
22 }
23
24 function container() {
25 return document.getElementById('container');
26 }
27
28 function enterFullscreen() {
29 container().webkitRequestFullscreen();
30 }
31
32 function consumeEvent(t, e) {
33 container().innerHTML += t + ' ' + e.code + '\n';
34 e.preventDefault();
35 }
36
37 function init() {
38 document.addEventListener('keydown', (e) => {
39 if (e.code == 'KeyS') {
40 enterFullscreen();
41 }
42 consumeEvent('keydown', e);
43 });
44
45 document.addEventListener('keyup', (e) => {
46 consumeEvent('keyup', e);
47
48 if (e.code == 'KeyX') {
49 done = true;
50 }
51 });
52
53 document.addEventListener('keypress', (e) => {
54 consumeEvent('keypress', e);
55 });
56 }
57 </script>
58 </head>
59 <body onload='init()'>
60 <div id='container'>
61 </div>
62 </body>
63 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698