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 }, function () { | |
Matt Perry
2011/11/18 20:16:37
note, you can also wrap the callbacks in a chrome.
Zachary Kuznia
2011/11/21 05:30:21
Done.
| |
14 chrome.test.assertNoLastError(); | |
15 chrome.test.succeed(); | |
16 }); | |
17 } | |
18 | |
19 | |
20 function clearCompositionTest() { | |
21 chrome.experimental.input.ime.clearComposition({ | |
22 "contextID": 1 | |
23 }, function () { | |
24 chrome.test.assertNoLastError(); | |
25 chrome.test.succeed(); | |
26 }); | |
27 } | |
28 | |
29 | |
30 function commitTextTest() { | |
31 chrome.experimental.input.ime.commitText({ | |
32 "contextID": 2, | |
33 "text": "Seaguls" | |
34 }, function () { | |
35 chrome.test.assertNoLastError(); | |
36 chrome.test.succeed(); | |
37 }); | |
38 } | |
39 | |
40 | |
41 function setCandidateWindowPropertiesTest() { | |
42 chrome.experimental.input.ime.setCandidateWindowProperties({ | |
43 "engineID": "test", | |
44 "properties": { | |
45 "visible": true, | |
46 "cursorVisible": false, | |
47 "vertical": true, | |
48 "pageSize": 6, | |
49 "auxiliaryText": "notes", | |
50 "auxiliaryTextVisible": true | |
51 } | |
52 }, function () { | |
53 chrome.test.assertNoLastError(); | |
54 chrome.test.succeed(); | |
55 }); | |
56 } | |
57 | |
58 | |
59 function setCandidatesTest() { | |
60 chrome.experimental.input.ime.setCandidates({ | |
61 "contextID": 8, | |
62 "candidates": [{ | |
63 "candidate": "one", | |
64 "id": 1, | |
65 "label": "first", | |
66 "annotation": "The first one" | |
67 }, { | |
68 "candidate": "two", | |
69 "id": 2, | |
70 "label": "second", | |
71 "annotation": "The second one" | |
72 }, { | |
73 "candidate": "three", | |
74 "id": 3, | |
75 "label": "third", | |
76 "annotation": "The third one" | |
77 }] | |
78 }, function () { | |
79 chrome.test.assertNoLastError(); | |
80 chrome.test.succeed(); | |
81 }); | |
82 } | |
83 | |
84 | |
85 function setCursorPositionTest() { | |
86 chrome.experimental.input.ime.setCursorPosition({ | |
87 "contextID": 9, | |
88 "candidateID": 1 | |
89 }, function () { | |
90 chrome.test.assertNoLastError(); | |
91 chrome.test.succeed(); | |
92 }); | |
93 } | |
94 | |
95 | |
96 | |
2 function setMenuItemsTest() { | 97 function setMenuItemsTest() { |
3 chrome.experimental.input.ime.setMenuItems({ | 98 chrome.experimental.input.ime.setMenuItems({ |
4 "engineID": "test", | 99 "engineID": "test", |
5 "items": [{ | 100 "items": [{ |
6 "id": "Menu 1", | 101 "id": "Menu 1", |
7 "label": "Menu 1", | 102 "label": "Menu 1", |
8 "style": "check", | 103 "style": "check", |
9 "visible": true, | 104 "visible": true, |
10 "enabled": true | 105 "enabled": true |
11 }, { | 106 }, { |
(...skipping 18 matching lines...) Expand all Loading... | |
30 }, { | 125 }, { |
31 "id": "Menu 2", | 126 "id": "Menu 2", |
32 "visible": false, | 127 "visible": false, |
33 }] | 128 }] |
34 }, function () { | 129 }, function () { |
35 chrome.test.assertNoLastError(); | 130 chrome.test.assertNoLastError(); |
36 chrome.test.succeed(); | 131 chrome.test.succeed(); |
37 }); | 132 }); |
38 } | 133 } |
39 | 134 |
40 chrome.test.runTests([setMenuItemsTest, updateMenuItemsTest]); | 135 chrome.test.runTests([setCompositionTest, clearCompositionTest, |
136 commitTextTest, setCandidateWindowPropertiesTest, | |
137 setCandidatesTest, setCursorPositionTest, | |
138 setMenuItemsTest, updateMenuItemsTest]); | |
41 </script> | 139 </script> |
OLD | NEW |