| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var current = chrome.app.window.current(); | 5 var current = chrome.app.window.current(); |
| 6 var bg = null; | 6 var bg = null; |
| 7 var nextTestNumber = 1; | 7 var nextTestNumber = 1; |
| 8 | 8 |
| 9 function makeEventTest(eventName, startFunction) { | 9 function makeEventTest(eventName, startFunction) { |
| 10 var test = function() { | 10 var test = function() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return test; | 32 return test; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 var tests = [ | 36 var tests = [ |
| 37 | 37 |
| 38 makeEventTest('onMinimized', function() { current.minimize(); }), | 38 makeEventTest('onMinimized', function() { current.minimize(); }), |
| 39 makeEventTest('onMaximized', function() { current.maximize(); }), | 39 makeEventTest('onMaximized', function() { current.maximize(); }), |
| 40 makeEventTest('onRestored', function() { | 40 makeEventTest('onRestored', function() { |
| 41 current.minimize(); | 41 current.minimize(); |
| 42 current.restore(); | 42 current['onMinimized'].addListener(function() { |
| 43 current.restore(); |
| 44 }); |
| 43 }), | 45 }), |
| 44 makeEventTest('onRestored', function() { | 46 makeEventTest('onRestored', function() { |
| 45 current.maximize(); | 47 current.maximize(); |
| 46 current.restore(); | 48 // Don't call |restore| immediately. On GTK+ platform the restore method |
| 49 // will depend on the previous window state. |
| 50 current['onMaximized'].addListener(function() { |
| 51 current.restore(); |
| 52 }) |
| 47 }), | 53 }), |
| 48 makeEventTest('onBoundsChanged', function() { | 54 makeEventTest('onBoundsChanged', function() { |
| 49 current.setBounds({left:5, top:5, width:100, height:100}); | 55 current.setBounds({left:5, top:5, width:100, height:100}); |
| 50 }) | 56 }) |
| 51 | 57 |
| 52 ]; | 58 ]; |
| 53 | 59 |
| 54 chrome.runtime.getBackgroundPage(function(page) { | 60 chrome.runtime.getBackgroundPage(function(page) { |
| 55 bg = page; | 61 bg = page; |
| 56 chrome.test.runTests(tests); | 62 chrome.test.runTests(tests); |
| 57 }); | 63 }); |
| OLD | NEW |