OLD | NEW |
1 <script> | 1 <script> |
| 2 function setCompositionTest() { |
| 3 chrome.experimental.input.ime.setComposition({ |
| 4 "contextID": 1, |
| 5 "text": "Pie", |
| 6 "selectionStart": 1, |
| 7 "selectionEnd": 2, |
| 8 "segments": [{ |
| 9 "start": 0, |
| 10 "end": 1, |
| 11 "style": "underline" |
| 12 }] |
| 13 }, chrome.test.callbackPass()); |
| 14 } |
| 15 |
| 16 |
| 17 function clearCompositionTest() { |
| 18 chrome.experimental.input.ime.clearComposition({ |
| 19 "contextID": 1 |
| 20 }, chrome.test.callbackPass()); |
| 21 } |
| 22 |
| 23 |
| 24 function commitTextTest() { |
| 25 chrome.experimental.input.ime.commitText({ |
| 26 "contextID": 2, |
| 27 "text": "Seaguls" |
| 28 }, chrome.test.callbackPass()); |
| 29 } |
| 30 |
| 31 |
| 32 function setCandidateWindowPropertiesTest() { |
| 33 chrome.experimental.input.ime.setCandidateWindowProperties({ |
| 34 "engineID": "test", |
| 35 "properties": { |
| 36 "visible": true, |
| 37 "cursorVisible": false, |
| 38 "vertical": true, |
| 39 "pageSize": 6, |
| 40 "auxiliaryText": "notes", |
| 41 "auxiliaryTextVisible": true |
| 42 } |
| 43 }, chrome.test.callbackPass()); |
| 44 } |
| 45 |
| 46 |
| 47 function setCandidatesTest() { |
| 48 chrome.experimental.input.ime.setCandidates({ |
| 49 "contextID": 8, |
| 50 "candidates": [{ |
| 51 "candidate": "one", |
| 52 "id": 1, |
| 53 "label": "first", |
| 54 "annotation": "The first one" |
| 55 }, { |
| 56 "candidate": "two", |
| 57 "id": 2, |
| 58 "label": "second", |
| 59 "annotation": "The second one" |
| 60 }, { |
| 61 "candidate": "three", |
| 62 "id": 3, |
| 63 "label": "third", |
| 64 "annotation": "The third one" |
| 65 }] |
| 66 }, chrome.test.callbackPass()); |
| 67 } |
| 68 |
| 69 |
| 70 function setCursorPositionTest() { |
| 71 chrome.experimental.input.ime.setCursorPosition({ |
| 72 "contextID": 9, |
| 73 "candidateID": 1 |
| 74 }, chrome.test.callbackPass()); |
| 75 } |
| 76 |
| 77 |
| 78 |
2 function setMenuItemsTest() { | 79 function setMenuItemsTest() { |
3 chrome.experimental.input.ime.setMenuItems({ | 80 chrome.experimental.input.ime.setMenuItems({ |
4 "engineID": "test", | 81 "engineID": "test", |
5 "items": [{ | 82 "items": [{ |
6 "id": "Menu 1", | 83 "id": "Menu 1", |
7 "label": "Menu 1", | 84 "label": "Menu 1", |
8 "style": "check", | 85 "style": "check", |
9 "visible": true, | 86 "visible": true, |
10 "enabled": true | 87 "enabled": true |
11 }, { | 88 }, { |
12 "id": "Menu 2", | 89 "id": "Menu 2", |
13 "label": "Menu 2", | 90 "label": "Menu 2", |
14 "style": "radio", | 91 "style": "radio", |
15 "visible": true, | 92 "visible": true, |
16 "enabled": true | 93 "enabled": true |
17 }] | 94 }] |
18 }, function () { | 95 }, chrome.test.callbackPass()); |
19 chrome.test.assertNoLastError(); | |
20 chrome.test.succeed(); | |
21 }); | |
22 } | 96 } |
23 | 97 |
24 function updateMenuItemsTest() { | 98 function updateMenuItemsTest() { |
25 chrome.experimental.input.ime.updateMenuItems({ | 99 chrome.experimental.input.ime.updateMenuItems({ |
26 "engineID": "test", | 100 "engineID": "test", |
27 "items": [{ | 101 "items": [{ |
28 "id": "Menu 1", | 102 "id": "Menu 1", |
29 "enabled": false | 103 "enabled": false |
30 }, { | 104 }, { |
31 "id": "Menu 2", | 105 "id": "Menu 2", |
32 "visible": false, | 106 "visible": false, |
33 }] | 107 }] |
34 }, function () { | 108 }, chrome.test.callbackPass()); |
35 chrome.test.assertNoLastError(); | |
36 chrome.test.succeed(); | |
37 }); | |
38 } | 109 } |
39 | 110 |
40 chrome.test.runTests([setMenuItemsTest, updateMenuItemsTest]); | 111 chrome.test.runTests([setCompositionTest, clearCompositionTest, |
| 112 commitTextTest, setCandidateWindowPropertiesTest, |
| 113 setCandidatesTest, setCursorPositionTest, |
| 114 setMenuItemsTest, updateMenuItemsTest]); |
41 </script> | 115 </script> |
OLD | NEW |