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

Side by Side Diff: chrome/test/data/extensions/platform_apps/prevent_leave_fullscreen/main.js

Issue 132243004: Revert of Enable all ESC-Fullscreen tests (Chrome Apps) for all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 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
« no previous file with comments | « chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 chrome.app.runtime.onLaunched.addListener(function() { 5 chrome.app.runtime.onLaunched.addListener(function() {
6 chrome.app.window.create('main.html', {}, function(win) { 6 chrome.app.window.create('main.html', {}, function(win) {
7 // The following key events handler will prevent the default behavior for 7 // The following key events handler will prevent the default behavior for
8 // the ESC key, thus will prevent the ESC key to leave fullscreen. 8 // the ESC key, thus will prevent the ESC key to leave fullscreen.
9 win.contentWindow.document.addEventListener('keydown', function(e) { 9 win.contentWindow.document.addEventListener('keydown', function(e) {
10 e.preventDefault(); 10 e.preventDefault();
11 }); 11 });
12 win.contentWindow.document.addEventListener('keyup', function(e) { 12 win.contentWindow.document.addEventListener('keyup', function(e) {
13 e.preventDefault(); 13 e.preventDefault();
14 }); 14 });
15 15
16 chrome.test.sendMessage('Launched', function(reply) { 16 chrome.test.sendMessage('Launched', function(reply) {
17 var doc = win.contentWindow.document; 17 var doc = win.contentWindow.document;
18 doc.addEventListener('keydown', function(e) {
19 if (e.keyCode != 90) // 'z'
20 return;
21 chrome.test.sendMessage('KeyReceived');
22 });
23 18
24 switch (reply) { 19 switch (reply) {
25 case 'window': 20 case 'window':
26 doc.addEventListener('keydown', function(e) { 21 doc.addEventListener('keydown', function(e) {
27 if (e.keyCode != 66) // 'b' 22 if (e.keyCode != 66) // 'b'
28 return; 23 return;
29 doc.removeEventListener('keydown', arguments.callee); 24 doc.removeEventListener('keydown', arguments.callee);
30 // We do one trip to the event loop to increase the chances that 25 // We do one trip to the event loop to increase the chances that
31 // fullscreen could have been left before the message is received. 26 // fullscreen could have been left before the message is received.
32 setTimeout(function() { 27 setTimeout(function() {
(...skipping 18 matching lines...) Expand all
51 }); 46 });
52 }); 47 });
53 48
54 doc.body.webkitRequestFullscreen(); 49 doc.body.webkitRequestFullscreen();
55 }); 50 });
56 break; 51 break;
57 } 52 }
58 }); 53 });
59 }); 54 });
60 }); 55 });
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698