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

Unified 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698