Index: chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js |
diff --git a/chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js b/chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js |
index 95940b1c3f67c163a0088d040af1dc6863aaaf7d..38a72b69dd0e1dd94a4245fa4e51d7d8ba4429b5 100644 |
--- a/chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js |
+++ b/chrome/test/data/extensions/platform_apps/leave_fullscreen/main.js |
@@ -4,35 +4,37 @@ |
chrome.app.runtime.onLaunched.addListener(function() { |
chrome.app.window.create('main.html', {}, function(win) { |
- // The following key events handler should have no effect because the |
- // application does not have the 'overrideEscFullscreen' permission. |
- win.contentWindow.document.addEventListener('keydown', function(e) { |
- e.preventDefault(); |
- }); |
- win.contentWindow.document.addEventListener('keyup', function(e) { |
- e.preventDefault(); |
- }); |
- |
- chrome.test.sendMessage('Launched', function(reply) { |
+ win.onWindowFirstShown.addListener(function() { |
+ // The following key events handler should have no effect because the |
+ // application does not have the 'overrideEscFullscreen' permission. |
win.contentWindow.document.addEventListener('keydown', function(e) { |
- if (e.keyCode != 90) // 'z' |
- return; |
- |
- chrome.test.sendMessage('KeyReceived'); |
+ e.preventDefault(); |
}); |
+ win.contentWindow.document.addEventListener('keyup', function(e) { |
+ e.preventDefault(); |
+ }); |
+ |
+ chrome.test.sendMessage('Launched', function(reply) { |
+ win.contentWindow.document.addEventListener('keydown', function(e) { |
+ if (e.keyCode != 90) // 'z' |
+ return; |
- switch (reply) { |
- case 'window': |
- win.fullscreen(); |
- break; |
- case 'dom': |
- win.contentWindow.document.addEventListener('keydown', function() { |
- win.contentWindow.document.removeEventListener('keydown', |
- arguments.callee); |
- win.contentWindow.document.body.webkitRequestFullscreen(); |
- }); |
- break; |
- } |
+ chrome.test.sendMessage('KeyReceived'); |
+ }); |
+ |
+ switch (reply) { |
+ case 'window': |
+ win.fullscreen(); |
+ break; |
+ case 'dom': |
+ win.contentWindow.document.addEventListener('keydown', function() { |
+ win.contentWindow.document.removeEventListener('keydown', |
+ arguments.callee); |
+ win.contentWindow.document.body.webkitRequestFullscreen(); |
+ }); |
+ break; |
+ } |
+ }); |
}); |
}); |
}); |