Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / chrome / test / data / extensions / platform_apps / windows_api_ime / no_permissions_platform_app / 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 var error = "The \"ime\" option is not supported for platform app.";
6
7 function testImeEnabled(setOption, opt_setValue) {
8   var createOptions = { frame: 'none' };
9   if (setOption) {
10     createOptions.ime = opt_setValue;
11     chrome.app.window.create('index.html',
12                              createOptions,
13                              chrome.test.callbackFail(error));
14   } else {
15     chrome.app.window.create('index.html',
16                              createOptions,
17                              chrome.test.callbackPass(function(win){}));
18   }
19 }
20
21 // All these tests are run without app.window.ime permission set and on a system
22 // with ime window support.
23 chrome.app.runtime.onLaunched.addListener(function() {
24   chrome.test.runTests([
25     // Window is created with ime explicitly set by platform app.
26     // Expect fail.
27     function testImeNoPermissionImeInitTrue() {
28       testImeEnabled(true, true);
29       testImeEnabled(true, false);
30     },
31
32     // Window is created with ime not explicitly set.
33     function testImeNoPermissionImeNoInit() {
34       testImeEnabled(false);
35     }
36   ]);
37 });