Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7574)

Unified Diff: chrome/test/data/extensions/api_test/input_ime_nonchromeos/background.js

Issue 1780523006: Add tests for input.ime.* APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc ('k') | ui/base/ime/dummy_text_input_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+ });
+ }
]);
« no previous file with comments | « chrome/browser/ui/views/ime/input_ime_apitest_nonchromeos.cc ('k') | ui/base/ime/dummy_text_input_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698