Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / platform_apps / windows_api_alpha_enabled / has_permissions_no_alpha / background.js
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
3 // found in the LICENSE file.
4
5 function testAlphaEnabled(testId, setOption, setValue, expectedValue) {
6   var createOptions = { frame: 'none' };
7   if (setOption)
8     createOptions.alphaEnabled = setValue;
9
10   chrome.app.window.create('index.html',
11                            createOptions,
12                            chrome.test.callbackPass(function(win) {
13       chrome.test.assertEq(expectedValue, win.alphaEnabled());
14   }));
15 }
16
17 // All these tests are run with app.window.alpha permission
18 // set and on a system without alpha (transparency) support.
19
20 chrome.app.runtime.onLaunched.addListener(function() {
21   chrome.test.runTests([
22
23     // Window is created with alphaEnabled set to true.
24     function testAlphaEnabledPermNoTransInitTrue() {
25       testAlphaEnabled('testAlphaEnabledPermNoTransInitTrue',
26                        true, true, false);
27     },
28
29     // Window is created with alphaEnabled set to false.
30     function testAlphaEnabledPermNoTransInitFalse() {
31       testAlphaEnabled('testAlphaEnabledPermNoTransInitFalse',
32                        true, false, false);
33     },
34
35     // Window is created with alphaEnabled not explicitly set.
36     function testAlphaEnabledPermNoTransNoInit() {
37       testAlphaEnabled('testAlphaEnabledPermNoTransNoInit',
38                        false, false, false);
39     }
40
41   ]);
42 });