OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // experimental.input API test for Chrome |
| 6 // browser_tests --gtest_filter=ExtensionApiTest.Input |
| 7 |
| 8 chrome.test.runTests([ |
| 9 function sendKeyboardEvent() { |
| 10 var e = { 'type': 'keydown', 'keyIdentifier': 'A' }; |
| 11 chrome.experimental.input.sendKeyboardEvent(e, function() { |
| 12 if (chrome.extension.lastError) { |
| 13 // this is expected for now: no one is handling keys yet |
| 14 // chrome.test.fail(); |
| 15 } |
| 16 // when the browser is listening to events, we should check that |
| 17 // this event was delivered as we expected. For now, just succeed. |
| 18 chrome.test.succeed(); |
| 19 }); |
| 20 }, |
| 21 |
| 22 function badKeyIdentifier() { |
| 23 var e = { 'type': 'keydown', 'keyIdentifier': 'BogusId' }; |
| 24 chrome.experimental.input.sendKeyboardEvent(e, function() { |
| 25 if (!chrome.extension.lastError) { |
| 26 chrome.test.fail(); |
| 27 } |
| 28 chrome.test.succeed(); |
| 29 }); |
| 30 }, |
| 31 |
| 32 function badEventType() { |
| 33 var e = { 'type': 'BAD', 'keyIdentifier': 'A' }; |
| 34 chrome.experimental.input.sendKeyboardEvent(e, function() { |
| 35 if (!chrome.extension.lastError) { |
| 36 chrome.test.fail(); |
| 37 } |
| 38 chrome.test.succeed(); |
| 39 }); |
| 40 }, |
| 41 |
| 42 function unmappedKeyIdentifier() { |
| 43 var e = { 'type': 'keydown', 'keyIdentifier': 'Again' }; |
| 44 chrome.experimental.input.sendKeyboardEvent(e, function() { |
| 45 if (!chrome.extension.lastError) { |
| 46 chrome.test.fail(); |
| 47 } |
| 48 chrome.test.succeed(); |
| 49 }); |
| 50 }, |
| 51 ]); |
OLD | NEW |