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..6b268e9e92161c27a1215f48d84641e5f45415a8 |
--- /dev/null |
+++ b/chrome/test/data/chromeos/virtual_keyboard/end_to_end_test.js |
@@ -0,0 +1,31 @@ |
+/* |
+ * 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 {{string}} char The character to type. |
+ */ |
+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() { |
+ if (kb.isReady()) |
+ type('a'); |
+ }); |
+} |