| Index: chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js b/chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js
|
| index bfb6d189db92c5ca24646f4ddc82026f1fd08b81..3bcb0194e2badd65ecaddf23e2ce37b8a037b652 100644
|
| --- a/chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js
|
| +++ b/chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js
|
| @@ -2,6 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +var failToSendKeyEvents = 'Could not send key events';
|
| +
|
| chrome.test.runTests([
|
| function testActivate() {
|
| var focused = false;
|
| @@ -53,24 +55,6 @@ chrome.test.runTests([
|
| chrome.test.succeed();
|
| });
|
| },
|
| -
|
| - function testSendKeyEvents() {
|
| - chrome.input.ime.sendKeyEvents({
|
| - 'contextID': 1,
|
| - 'keyData': [{
|
| - 'type': 'keydown',
|
| - 'requestId': '0',
|
| - 'key': 'a',
|
| - 'code': 'KeyA'
|
| - }, {
|
| - 'type': 'keyup',
|
| - 'requestId': '1',
|
| - 'key': 'a',
|
| - 'code': 'KeyA'
|
| - }]
|
| - });
|
| - chrome.test.succeed();
|
| - },
|
| function testCommitText() {
|
| chrome.input.ime.commitText({
|
| contextID: 1,
|
| @@ -95,5 +79,63 @@ chrome.test.runTests([
|
| }
|
| chrome.test.succeed();
|
| });
|
| + },
|
| + function testSendKeyEvents() {
|
| + // Sends a normal character key.
|
| + chrome.input.ime.sendKeyEvents({
|
| + contextID: 1,
|
| + keyData: [{
|
| + type: 'keydown',
|
| + requestId: '0',
|
| + key: 'a',
|
| + code: 'KeyA'
|
| + }, {
|
| + type: 'keyup',
|
| + requestId: '1',
|
| + key: 'a',
|
| + code: 'KeyA'
|
| + }]
|
| + }, function() {
|
| + // Normal character key should be allowed to send on any page.
|
| + chrome.test.assertNoLastError();
|
| + });
|
| + // Sends Ctrl+A that should fail on special pages.
|
| + chrome.input.ime.sendKeyEvents({
|
| + contextID: 1,
|
| + keyData: [{
|
| + type: 'keydown',
|
| + requestId: '2',
|
| + key: 'a',
|
| + code: 'KeyA',
|
| + ctrlKey: true
|
| + }, {
|
| + type: 'keyup',
|
| + requestId: '3',
|
| + key: 'a',
|
| + code: 'KeyA',
|
| + ctrlKey: true
|
| + }]
|
| + }, function() {
|
| + if (chrome.runtime.lastError) {
|
| + chrome.test.assertEq(failToSendKeyEvents,
|
| + chrome.runtime.lastError.message);
|
| + }
|
| + });
|
| + // Sends Tab key that should fail on special pages.
|
| + chrome.input.ime.sendKeyEvents({
|
| + contextID: 1,
|
| + keyData: [{
|
| + type: 'keydown',
|
| + requestId: '4',
|
| + key: '\u0009', // Unicode value for Tab key.
|
| + code: 'Tab'
|
| + }]
|
| + }, function() {
|
| + if (chrome.runtime.lastError) {
|
| + chrome.test.assertEq(failToSendKeyEvents,
|
| + chrome.runtime.lastError.message);
|
| + }
|
| + });
|
| + chrome.test.succeed();
|
| }
|
| ]);
|
|
|