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

Unified Diff: chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nasko@ comments. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
index c8c3c81045b7ce7aca4200ea35431b4925898b60..eebf6aced8e45bc9a28eaa785ab2d5fef196151a 100644
--- a/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
+++ b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus.js
@@ -47,6 +47,31 @@ var waitForFocus = function() {
inputElement.focus();
};
+var createInput = function(count) {
+ inputElement = document.createElement('input');
+ inputElement.eventCount = count;
+ inputElement.addEventListener('click', function(e) {
+ sendMessage(['response-elementClicked']);
+ });
+ inputElement.addEventListener('input', function(e) {
+ inputElement.eventCount -= 1;
+ if (inputElement.eventCount <= 0 && inputElement.signalOnInput) {
+ sendMessage(['response-inputValue', inputElement.value]);
+ }
+ });
+
+ document.body.appendChild(inputElement);
+ sendMessage(['response-createdInput']);
+};
+
+var getInputValue = function() {
+ if (inputElement.eventCount <= 0) {
+ sendMessage(['response-inputValue', inputElement.value]);
+ } else {
+ inputElement.signalOnInput = true;
+ }
+}
+
window.addEventListener('message', function(e) {
var data = JSON.parse(e.data);
if (data[0] == 'connect') {
@@ -59,6 +84,10 @@ window.addEventListener('message', function(e) {
waitForFocus();
} else if (data[0] == 'request-waitForBlurAfterFocus') {
waitForBlurAfterFocus();
+ } else if (data[0] == 'request-createInput') {
+ createInput(data[1]);
+ } else if (data[0] == 'request-getInputValue') {
+ getInputValue();
}
});

Powered by Google App Engine
This is Rietveld 408576698