Commit 268665d5 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Enable key event injection in ChromeVox js e2e tests

- minimal setup for enabling and creating vk which routes key events
- add a test for native find
- eliminate double speak in find handler by checking current range

Bug: 
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I13000974b3fe917c4179191b72d8940551612fbb
Reviewed-on: https://chromium-review.googlesource.com/827166
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524570}
parent ce0ed425
......@@ -24,6 +24,8 @@ BackgroundTest.prototype = {
setUp: function() {
window.RoleType = chrome.automation.RoleType;
window.doCmd = this.doCmd;
window.press = this.press;
window.Mod = constants.ModifierFlag;
this.forceContextualLastOutput();
},
......@@ -49,6 +51,12 @@ BackgroundTest.prototype = {
};
},
press: function(keyCode, keyName, modifiers) {
return function() {
BackgroundKeyboardHandler.sendKeyPress(keyCode, keyName, modifiers);
};
},
linksAndHeadingsDoc: function() {/*!
<p>start</p>
<a href='#a'>alpha</a>
......@@ -1272,3 +1280,20 @@ TEST_F('BackgroundTest', 'NodeVsSubnode', function() {
.replay();
});
});
TEST_F('BackgroundTest', 'NativeFind', function() {
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function(root) {/*!
<a href="#">grape</a>
<a href="#">pineapple</a>
*/}, function(root) {
mockFeedback.call(press(70, 'F', Mod.CONTROL))
.expectSpeech('Find', 'Edit text')
.call(press(71, 'G'))
.expectSpeech('grape', 'Link')
.call(press(8, 'Backspace'))
.call(press(76, 'L'))
.expectSpeech('pineapple', 'Link')
.replay();
});
});
......@@ -34,16 +34,20 @@ ChromeVoxE2ETest.prototype = {
testGenCppIncludes: function() {
GEN_BLOCK(function() { /*!
#include "ash/accessibility/accessibility_delegate.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/callback.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/common/extensions/extension_constants.h"
#include "ui/keyboard/keyboard_util.h"
*/ });
},
/** @override */
testGenPreamble: function() {
GEN_BLOCK(function() { /*!
keyboard::SetRequestedKeyboardState(keyboard::KEYBOARD_STATE_ENABLED);
ash::Shell::Get()->CreateKeyboard();
base::Closure load_cb =
base::Bind(&chromeos::AccessibilityManager::EnableSpokenFeedback,
base::Unretained(chromeos::AccessibilityManager::Get()),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment