Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/windows_api_ime/has_permissions_whitelisted/background.js |
| diff --git a/chrome/test/data/extensions/platform_apps/windows_api_ime/has_permissions_whitelisted/background.js b/chrome/test/data/extensions/platform_apps/windows_api_ime/has_permissions_whitelisted/background.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f28a26c6c27397f726c6aaee5b58ac75edd4b81a |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/platform_apps/windows_api_ime/has_permissions_whitelisted/background.js |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var error = "The ime option must be set for non platform app."; |
| + |
| +function testImeEnabled(testId, setOption, opt_setValue, opt_expectedValue) { |
| + var createOptions = { frame: 'none' }; |
| + if (setOption) { |
| + createOptions.ime = opt_setValue; |
| + chrome.app.window.create('index.html', |
| + createOptions, |
| + chrome.test.callbackPass(function(win) { |
| + chrome.test.assertEq(opt_expectedValue, win.isImeWindow()); |
| + })); |
| + } else { |
| + chrome.app.window.create('index.html', |
| + createOptions, |
| + chrome.test.callbackFail(error)); |
| + } |
| +} |
| + |
| +// All these tests are run with app.window.ime permission set and on a system |
| +// with ime window support. |
| +chrome.test.runTests([ |
| + |
| + // Window is created with ime set to true. |
| + function testImeEnabledPermTransInitTrue() { |
| + testImeEnabled('testImeEnabledPermTransInitTrue', |
| + true, true, true); |
| + }, |
| + |
| + // Window is created with ime set to false. |
| + function testImeEnabledPermTransInitFalse() { |
| + testImeEnabled('testImeEnabledPermTransInitFalse', |
|
jackhou1
2014/09/12 03:24:52
Do we actually allow this case (ime:false)? It wou
bshe
2014/09/12 17:44:12
The new patch disallow IME extensions to create no
|
| + true, false, false); |
| + }, |
| + |
| + // Window is created with ime not explicitly set. |
| + function testImeEnabledPermTransNoInit() { |
| + testImeEnabled('testImeEnabledPermTransNoInit', |
| + false); |
| + } |
| + |
| +]); |