OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var callbackPass = chrome.test.callbackPass; |
| 6 |
| 7 function testAlwaysOnTop(testId, initValue, setOption) { |
| 8 var options = { id: testId }; |
| 9 if (setOption) |
| 10 options.alwaysOnTop = initValue; |
| 11 |
| 12 chrome.app.window.create('index.html', |
| 13 options, |
| 14 callbackPass(function(win) { |
| 15 // Check that isAlwaysOnTop() returns the initial value. |
| 16 chrome.test.assertEq(initValue, win.isAlwaysOnTop()); |
| 17 |
| 18 // Toggle the current value. |
| 19 // TODO(tmdiep): The new value of isAlwaysOnTop() should be checked |
| 20 // asynchronously, but we need a non-flaky way to do this. |
| 21 win.setAlwaysOnTop(!initValue); |
| 22 |
| 23 win.contentWindow.close(); |
| 24 })); |
| 25 } |
| 26 |
| 27 chrome.app.runtime.onLaunched.addListener(function() { |
| 28 chrome.test.runTests([ |
| 29 |
| 30 // Window is created with always on top enabled. |
| 31 function testAlwaysOnTopInitTrue() { |
| 32 testAlwaysOnTop('testAlwaysOnTopInitTrue', true, true); |
| 33 }, |
| 34 |
| 35 // Window is created with always on top explicitly disabled. |
| 36 function testAlwaysOnTopInitFalse() { |
| 37 testAlwaysOnTop('testAlwaysOnTopInitFalse', false, true); |
| 38 }, |
| 39 |
| 40 // Window is created with option not explicitly set. |
| 41 function testAlwaysOnTopNoInit() { |
| 42 testAlwaysOnTop('testAlwaysOnTopNoInit', false, false); |
| 43 } |
| 44 |
| 45 ]); |
| 46 }); |
OLD | NEW |