| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var failToSendKeyEvents = 'Could not send key events'; | 5 var failToSendKeyEvents = 'Could not send key events'; |
| 6 | 6 |
| 7 chrome.test.runTests([ | 7 chrome.test.runTests([ |
| 8 // Tests input.ime.activate and input.ime.onFocus APIs. | 8 // Tests input.ime.activate and input.ime.onFocus APIs. |
| 9 function testActivateAndFocus() { | 9 function testActivateAndFocus() { |
| 10 var focused = false; | 10 var focused = false; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 text: 'test_set_composition', | 76 text: 'test_set_composition', |
| 77 cursor: 2 | 77 cursor: 2 |
| 78 }, function() { | 78 }, function() { |
| 79 if(chrome.runtime.lastError) { | 79 if(chrome.runtime.lastError) { |
| 80 chrome.test.fail(); | 80 chrome.test.fail(); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 chrome.test.succeed(); | 83 chrome.test.succeed(); |
| 84 }); | 84 }); |
| 85 }, | 85 }, |
| 86 function testEmptyComposition() { |
| 87 chrome.input.ime.setComposition({ |
| 88 contextID: 1, |
| 89 text: '', |
| 90 cursor: 0 |
| 91 }, function() { |
| 92 if(chrome.runtime.lastError) { |
| 93 chrome.test.fail(); |
| 94 return; |
| 95 } |
| 96 chrome.test.succeed(); |
| 97 }); |
| 98 }, |
| 86 // Test input.ime.sendKeyEvents API. | 99 // Test input.ime.sendKeyEvents API. |
| 87 function testSendKeyEvents() { | 100 function testSendKeyEvents() { |
| 88 // Sends a normal character key. | 101 // Sends a normal character key. |
| 89 chrome.input.ime.sendKeyEvents({ | 102 chrome.input.ime.sendKeyEvents({ |
| 90 contextID: 1, | 103 contextID: 1, |
| 91 keyData: [{ | 104 keyData: [{ |
| 92 type: 'keydown', | 105 type: 'keydown', |
| 93 requestId: '0', | 106 requestId: '0', |
| 94 key: 'a', | 107 key: 'a', |
| 95 code: 'KeyA' | 108 code: 'KeyA' |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (context.type != 'none') { | 161 if (context.type != 'none') { |
| 149 // Waits for the 'get_blur_event' message in | 162 // Waits for the 'get_blur_event' message in |
| 150 // InputImeApiTest.BasicApiTest. | 163 // InputImeApiTest.BasicApiTest. |
| 151 chrome.test.sendMessage('get_blur_event'); | 164 chrome.test.sendMessage('get_blur_event'); |
| 152 } | 165 } |
| 153 chrome.test.succeed(); | 166 chrome.test.succeed(); |
| 154 }); | 167 }); |
| 155 chrome.test.succeed(); | 168 chrome.test.succeed(); |
| 156 } | 169 } |
| 157 ]); | 170 ]); |
| OLD | NEW |