| 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 e3ba1d6ef705d8e9be9ab6a54bcafca377c8e80e..14c76ada5002c31b70b9035adc4610f8f06a07c0 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
|
| @@ -12,6 +12,7 @@ chrome.test.runTests([
|
| return;
|
| }
|
| focused = true;
|
| + chrome.test.sendMessage('get_focus_event');
|
| if (activated)
|
| chrome.test.succeed();
|
| });
|
| @@ -52,5 +53,75 @@ chrome.test.runTests([
|
| win.addEventListener('unload', function() {});
|
| chrome.test.succeed();
|
| });
|
| + },
|
| + function testBlur() {
|
| + chrome.input.ime.onBlur.addListener(function(context) {
|
| + if (context.type == 'none') {
|
| + chrome.test.fail();
|
| + return;
|
| + }
|
| + chrome.test.sendMessage('get_blur_event');
|
| + chrome.test.succeed();
|
| + });
|
| + chrome.test.succeed();
|
| + },
|
| + function testCommitText() {
|
| + var composition_bounds_change_count = 0;
|
| + var composition_left = 0;
|
| + var composition_top = 0;
|
| + var composition_width = 0;
|
| + var composition_height = 0;
|
| + chrome.input.ime.onCompositionBoundsChanged.addListener(
|
| + function(boundsList) {
|
| + if (composition_bounds_change_count == 0) {
|
| + ++composition_bounds_change_count;
|
| + for (var i = 0; i < boundsList.length; i++ ) {
|
| + composition_left = boundsList[i].left;
|
| + composition_top = boundsList[i].top;
|
| + composition_width = boundsList[i].width;
|
| + composition_height = boundsList[i].height;
|
| + }
|
| + }
|
| + else {
|
| + for (var i = 0; i < boundsList.length; i++ ) {
|
| + chrome.test.assertEq(boundsList[i].top, composition_top);
|
| + chrome.test.assertEq(boundsList[i].height, composition_height);
|
| + if (composition_left == boundsList[i].left ) {
|
| + composition_width = boundsList[i].width;
|
| + }
|
| + else {
|
| + chrome.test.assertEq(boundsList[i].left,
|
| + composition_left + composition_width);
|
| + composition_left = boundsList[i].left;
|
| + composition_width = boundsList[i].width;
|
| + }
|
| + }
|
| + }
|
| + chrome.test.succeed();
|
| + });
|
| + var commit_text_count = 0;
|
| + chrome.input.ime.commitText({
|
| + contextID: 1,
|
| + text: 'test_commit_text'
|
| + }, function () {
|
| + if (chrome.runtime.lastError) {
|
| + chrome.test.fail();
|
| + return;
|
| + }
|
| + chrome.test.succeed();
|
| + });
|
| + },
|
| + function testSetCompositionText() {
|
| + chrome.input.ime.setComposition({
|
| + contextID: 1,
|
| + text: 'test_composition_text',
|
| + cursor: 2
|
| + }, function () {
|
| + if (chrome.runtime.lastError) {
|
| + chrome.test.fail();
|
| + return;
|
| + }
|
| + chrome.test.succeed();
|
| + })
|
| }
|
| ]);
|
|
|