| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 kNewInputMethod = "fr::fra"; | 5 var kNewInputMethod = "fr::fra"; |
| 6 | 6 |
| 7 function setAndGetTest() { | 7 function setAndGetTest() { |
| 8 console.log('Changing input method to: ' + kNewInputMethod); | 8 console.log('Changing input method to: ' + kNewInputMethod); |
| 9 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, | 9 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, |
| 10 function (response) { | 10 function (response) { |
| 11 chrome.test.assertEq('done', response); | 11 chrome.test.assertEq('done', response); |
| 12 console.log('Getting current input method.'); | 12 console.log('Getting current input method.'); |
| 13 chrome.inputMethodPrivate.get(function (inputMethod) { | 13 chrome.inputMethodPrivate.get(function (inputMethod) { |
| 14 chrome.test.assertEq(inputMethod, kNewInputMethod); | 14 chrome.test.assertEq(kNewInputMethod, inputMethod); |
| 15 chrome.test.succeed(); | 15 chrome.test.succeed(); |
| 16 } | 16 } |
| 17 ); | 17 ); |
| 18 }); | 18 }); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function setAndObserveTest() { | 21 function setAndObserveTest() { |
| 22 console.log('Adding input method event listener.'); | 22 console.log('Adding input method event listener.'); |
| 23 chrome.inputMethodPrivate.onChanged.addListener( | 23 chrome.inputMethodPrivate.onChanged.addListener( |
| 24 function(newInputMethod) { | 24 function(newInputMethod) { |
| 25 chrome.test.assertEq(kNewInputMethod, newInputMethod); | 25 chrome.test.assertEq(kNewInputMethod, newInputMethod); |
| 26 chrome.test.succeed(); | 26 chrome.test.succeed(); |
| 27 } | 27 } |
| 28 ); | 28 ); |
| 29 console.log('Changing input method to: ' + kNewInputMethod); | 29 console.log('Changing input method to: ' + kNewInputMethod); |
| 30 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, | 30 chrome.test.sendMessage('setInputMethod:' + kNewInputMethod, |
| 31 function (response) { | 31 function (response) { |
| 32 chrome.test.assertEq('done', response); | 32 chrome.test.assertEq('done', response); |
| 33 } | 33 } |
| 34 ); | 34 ); |
| 35 } | 35 } |
| 36 | 36 |
| 37 chrome.test.sendMessage('ready'); |
| 37 chrome.test.runTests([setAndGetTest, setAndObserveTest]); | 38 chrome.test.runTests([setAndGetTest, setAndObserveTest]); |
| OLD | NEW |