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 d007bc68105ba5945bff9f498e52549d44355007..51569d1c8cc6298e8502935ae10b0806fdd657a6 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(); |
}); |
@@ -53,7 +54,17 @@ chrome.test.runTests([ |
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 testSendKeyEvents() { |
chrome.input.ime.sendKeyEvents({ |
'contextID': 1, |
@@ -70,5 +81,55 @@ chrome.test.runTests([ |
}] |
}); |
chrome.test.succeed(); |
- } |
+ }, |
+ function testCommitText() { |
+ chrome.input.ime.commitText({ |
+ contextID: 1, |
+ text: 'test_commit_text' |
+ }, function () { |
+ if (chrome.runtime.lastError) { |
+ chrome.test.fail(); |
+ return; |
+ } |
+ chrome.test.succeed(); |
+ }); |
+ }, |
+ function testComposition() { |
+ chrome.input.ime.onCompositionBoundsChanged.addListener( |
+ function(boundsList) { |
+ if (boundsList.length > 0 && boundsList[0].width > 1 ){ |
+ for (var i = 0; i < boundsList.length; i++ ) { |
+ if (i==0) { |
+ composition_left = boundsList[i].left; |
+ composition_top = boundsList[i].top; |
+ composition_width = boundsList[i].width; |
+ composition_height = boundsList[i].height; |
+ } |
+ else { |
+ chrome.test.assertEq(boundsList[i].top, composition_top); |
+ chrome.test.assertEq(boundsList[i].height, composition_height); |
+ chrome.test.assertEq(boundsList[i].left, |
+ composition_left + composition_width); |
+ composition_left = boundsList[i].left; |
+ composition_width = boundsList[i].width; |
+ } |
+ } |
+ } |
+ if (boundsList.length > 20) { |
+ chrome.test.sendMessage('finish_composition_test'); |
+ } |
+ chrome.test.succeed(); |
+ }); |
+ chrome.input.ime.setComposition({ |
+ contextID: 1, |
+ text: 'test_composition_text', |
+ cursor: 2 |
+ }, function() { |
+ if(chrome.runtime.lastError) { |
+ chrome.test.fail(); |
+ return; |
+ } |
+ chrome.test.succeed(); |
Shu Chen
2016/03/16 05:55:39
remove this line.
|
+ }); |
+ } |
]); |