Chromium Code Reviews| Index: chrome/test/data/fullscreen_keyboardlock/fullscreen_keyboardlock.html |
| diff --git a/chrome/test/data/fullscreen_keyboardlock/fullscreen_keyboardlock.html b/chrome/test/data/fullscreen_keyboardlock/fullscreen_keyboardlock.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..08e4aed2441a65afffab53ca41ccc73ba0303e66 |
| --- /dev/null |
| +++ b/chrome/test/data/fullscreen_keyboardlock/fullscreen_keyboardlock.html |
| @@ -0,0 +1,63 @@ |
| +<!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.
|
| +<html> |
| + <head> |
| + <title>Fullscreen Keyboard Lock Test</title> |
| + <script> |
| + let done = false; |
| + function report() { |
| + return new Promise((resolve, reject) => { |
| + let register = () => { |
| + window.setTimeout(() => { |
| + if (done) { |
| + resolve(); |
| + } else { |
| + register(); |
| + } |
| + }, 100); |
| + }; |
| + register(); |
| + }).then(() => { |
| + window.domAutomationController.send(container().innerHTML); |
| + }); |
| + } |
| + |
| + function container() { |
| + return document.getElementById('container'); |
| + } |
| + |
| + function enterFullscreen() { |
| + container().webkitRequestFullscreen(); |
| + } |
| + |
| + function consumeEvent(t, e) { |
| + container().innerHTML += t + ' ' + e.code + '\n'; |
| + e.preventDefault(); |
| + } |
| + |
| + function init() { |
| + document.addEventListener('keydown', (e) => { |
| + if (e.code == 'KeyS') { |
| + enterFullscreen(); |
| + } |
| + consumeEvent('keydown', e); |
| + }); |
| + |
| + document.addEventListener('keyup', (e) => { |
| + consumeEvent('keyup', e); |
| + |
| + if (e.code == 'KeyX') { |
| + done = true; |
| + } |
| + }); |
| + |
| + document.addEventListener('keypress', (e) => { |
| + consumeEvent('keypress', e); |
| + }); |
| + } |
| + </script> |
| + </head> |
| + <body onload='init()'> |
| + <div id='container'> |
| + </div> |
| + </body> |
| +</html> |