OLD | NEW |
1 <script> | 1 <!-- |
2 var kNewInputMethod = "ru::rus"; | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this |
3 | 3 * source code is governed by a BSD-style license that can be found in the |
4 function setAndGetTest() { | 4 * LICENSE file. |
5 console.log('Changing input method to: ' + kNewInputMethod); | 5 --> |
6 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, | 6 <script src="background.js"></script> |
7 function (response) { | |
8 chrome.test.assertEq('done', response); | |
9 console.log('Getting current input method.'); | |
10 chrome.inputMethodPrivate.get(function (inputMethod) { | |
11 chrome.test.assertEq(inputMethod, kNewInputMethod); | |
12 chrome.test.succeed(); | |
13 } | |
14 ); | |
15 }); | |
16 } | |
17 | |
18 function setAndObserveTest() { | |
19 console.log('Adding input method event listener.'); | |
20 chrome.inputMethodPrivate.onChanged.addListener( | |
21 function(newInputMethod) { | |
22 chrome.test.assertEq(kNewInputMethod, newInputMethod); | |
23 chrome.test.succeed(); | |
24 } | |
25 ); | |
26 console.log('Changing input method to: ' + kNewInputMethod); | |
27 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, | |
28 function (response) { | |
29 chrome.test.assertEq('done', response); | |
30 } | |
31 ); | |
32 } | |
33 | |
34 chrome.test.runTests([setAndGetTest, setAndObserveTest]); | |
35 </script> | |
OLD | NEW |