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.
5 var callbackPass = chrome.test.callbackPass;
7 function testAlwaysOnTop(testId, value) {
13 chrome.app.window.create('index.html',
15 callbackPass(function(win) {
16 // Check that isAlwaysOnTop() returns false because the feature is not
17 // permitted in Stable.
18 chrome.test.assertEq(false, win.isAlwaysOnTop());
20 // Attempt to use setAlwaysOnTop() to change the property. But this should
22 win.setAlwaysOnTop(value);
24 // setAlwaysOnTop is synchronous in the browser, so send an async request to
25 // ensure we get the updated value of isAlwaysOnTop.
26 chrome.runtime.getPlatformInfo(callbackPass(function(platformInfo) {
27 // Check that isAlwaysOnTop() returns false.
28 chrome.test.assertEq(false, win.isAlwaysOnTop());
30 win.contentWindow.close();
35 chrome.app.runtime.onLaunched.addListener(function() {
36 chrome.test.runTests([
38 // Try to enable alwaysOnTop on window creation and after window creation.
39 function testAlwaysOnTopEnable() {
40 testAlwaysOnTop('testAlwaysOnTopEnable', true);
43 // Try to disable alwaysOnTop on window creation and after window creation.
44 function testAlwaysOnTopDisable() {
45 testAlwaysOnTop('testAlwaysOnTopDisable', false);