| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This test gets sent commands to execute, which it is sent by the | 5 // This test gets sent commands to execute, which it is sent by the |
| 6 // controlling C++ code. This code then checks that the apps' active state | 6 // controlling C++ code. This code then checks that the apps' active state |
| 7 // is being tracked correctly. | 7 // is being tracked correctly. |
| 8 var windows = []; | 8 var windows = []; |
| 9 | 9 |
| 10 function windowClosed() { | 10 function windowClosed() { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 createOptions = {}; | 26 createOptions = {}; |
| 27 | 27 |
| 28 if (response == 'createMinimized') | 28 if (response == 'createMinimized') |
| 29 createOptions.state = 'minimized'; | 29 createOptions.state = 'minimized'; |
| 30 | 30 |
| 31 if (response == 'createHidden') | 31 if (response == 'createHidden') |
| 32 createOptions.hidden = true; | 32 createOptions.hidden = true; |
| 33 | 33 |
| 34 chrome.app.window.create('empty.html', createOptions, | 34 chrome.app.window.create('empty.html', createOptions, |
| 35 function(createdWindow) { | 35 function(createdWindow) { |
| 36 handleWindowReady = function() { | 36 createdWindow.onClosed.addListener(windowClosed); |
| 37 createdWindow.onClosed.addListener(windowClosed); | 37 windows.push(createdWindow); |
| 38 windows.push(createdWindow); | 38 processNextCommand(); |
| 39 processNextCommand(); | |
| 40 } | |
| 41 | |
| 42 if (createOptions.hidden) | |
| 43 handleWindowReady(); | |
| 44 else | |
| 45 createdWindow.handleWindowFirstShownForTests(handleWindowReady); | |
| 46 }); | 39 }); |
| 47 }); | 40 }); |
| 48 } | 41 } |
| 49 | 42 |
| 50 processNextCommand(); | 43 processNextCommand(); |
| OLD | NEW |