Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/testing/chromevox_e2e_test_base.js

Issue 2045603002: Handle the "key" field as opposed to keyIdentifier field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove DEPS changes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 GEN_INCLUDE([ 5 GEN_INCLUDE([
6 'common.js', 6 'common.js',
7 'callback_helper.js']); 7 'callback_helper.js']);
8 8
9 /** 9 /**
10 * Base test fixture for ChromeVox end to end tests. 10 * Base test fixture for ChromeVox end to end tests.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 }; 84 };
85 chrome.tabs.create(createParams, function(tab) { 85 chrome.tabs.create(createParams, function(tab) {
86 if (opt_callback) 86 if (opt_callback)
87 opt_callback(tab.url); 87 opt_callback(tab.url);
88 }); 88 });
89 }, 89 },
90 90
91 /** 91 /**
92 * Send a key to the page. 92 * Send a key to the page.
93 * @param {number} tabId Of the page. 93 * @param {number} tabId Of the page.
94 * @param {string} key Name of the key (e.g. Down). 94 * @param {string} key Name of the key (e.g. ArrowDown).
95 * @param {string} elementQueryString 95 * @param {string} elementQueryString
96 */ 96 */
97 sendKeyToElement: function(tabId, key, elementQueryString) { 97 sendKeyToElement: function(tabId, key, elementQueryString) {
98 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*! 98 var code = TestUtils.extractHtmlFromCommentEncodedString(function() {/*!
99 var target = document.body.querySelector('$1'); 99 var target = document.body.querySelector('$1');
100 target.focus(); 100 target.focus();
101 var evt = document.createEvent('KeyboardEvent'); 101 var evt = new KeyboardEvent('keydown', {view: window, key: '$0'});
dmazzoni 2016/06/10 20:38:49 Is view: window necessary here? You didn't use it
dtapuska 2016/06/10 20:42:45 no it probably isn't needed. I'll remove it.
102 evt.initKeyboardEvent('keydown', true, true, window, '$0', 0, false,
103 false, false, false);
104 document.activeElement.dispatchEvent(evt); 102 document.activeElement.dispatchEvent(evt);
105 */}, [key, elementQueryString]); 103 */}, [key, elementQueryString]);
106 104
107 chrome.tabs.executeScript(tabId, {code: code}); 105 chrome.tabs.executeScript(tabId, {code: code});
108 }, 106 },
109 107
110 /** 108 /**
111 * Creates a callback that optionally calls {@code opt_callback} when 109 * Creates a callback that optionally calls {@code opt_callback} when
112 * called. If this method is called one or more times, then 110 * called. If this method is called one or more times, then
113 * {@code testDone()} will be called when all callbacks have been called. 111 * {@code testDone()} will be called when all callbacks have been called.
114 * @param {Function=} opt_callback Wrapped callback that will have its this 112 * @param {Function=} opt_callback Wrapped callback that will have its this
115 * reference bound to the test fixture. 113 * reference bound to the test fixture.
116 * @return {Function} 114 * @return {Function}
117 */ 115 */
118 newCallback: function(opt_callback) { 116 newCallback: function(opt_callback) {
119 return this.callbackHelper_.wrap(opt_callback); 117 return this.callbackHelper_.wrap(opt_callback);
120 } 118 }
121 }; 119 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698