Chromium Code Reviews| Index: chrome/test/data/chromeos/virtual_keyboard/end_to_end_test.js |
| diff --git a/chrome/test/data/chromeos/virtual_keyboard/end_to_end_test.js b/chrome/test/data/chromeos/virtual_keyboard/end_to_end_test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..06efa181dc0dc37fb753c4c2780910feaada06b0 |
| --- /dev/null |
| +++ b/chrome/test/data/chromeos/virtual_keyboard/end_to_end_test.js |
| @@ -0,0 +1,30 @@ |
| +/* |
| + * Copyright 2013 The Chromium Authors. All rights reserved. |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +var kb = document.getElementById('keyboard'); |
| + |
| +/** |
| + * Finds the character specified and types it. Assumes that the default |
| + * layout is qwerty, and the default keyset is lower. |
| + * @param char The character to type. |
|
kevers
2013/11/22 18:50:50
nit: Missing param type.
rsadam
2013/11/25 15:21:02
Done.
|
| + */ |
| +var type = function(char) { |
| + var keyset = kb.querySelector('#qwerty-lower'); |
| + var keys = Array.prototype.slice.call(keyset.querySelectorAll('kb-key')); |
| + var key = keys.filter(function(key) { |
| + return key.charValue == char |
| + })[0]; |
| + key.down({pointerId: 1}) |
| + key.up({pointerId: 1}) |
| +} |
| + |
| +if(kb.isReady()) { |
| + type('a'); |
| +} else { |
| + kb.addKeysetChangedObserver(function() { |
| + type('a'); |
| + }); |
| +} |