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

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

Issue 2732913005: <webview>: Add test to confirm the TAB key will escape the view. (Closed)
Patch Set: rebase (focus controller change in ToT) Created 3 years, 7 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
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus_take_focus.js
diff --git a/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus_take_focus.js b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus_take_focus.js
new file mode 100644
index 0000000000000000000000000000000000000000..f8c653e7ba7a4cc8d56cca439112a5a2ec73a0e3
--- /dev/null
+++ b/chrome/test/data/extensions/platform_apps/web_view/focus/inject_focus_take_focus.js
@@ -0,0 +1,41 @@
+// Copyright 2017 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 embedder = null;
+
+var LOG = function(msg) {
+ window.console.log(msg);
+};
+
+var sendMessage = function(msgArray) {
+ if (embedder) {
+ embedder.postMessage(JSON.stringify(msgArray), '*');
+ }
+};
+
+var init = function() {
+ var input = document.createElement('input');
+ input.style.width = '100%';
+ input.addEventListener('focus', function(e) {
+ sendMessage(['focused']);
+ });
+
+ document.body.appendChild(input);
+
+ window.addEventListener('message', function(e) {
+ var data = JSON.parse(e.data);
+ embedder = e.source;
+ LOG('message, data: ' + data);
+ if (data[0] == 'connect') {
+ sendMessage(['connected']);
+ } else if (data[0] == 'request-coords') {
+ var rect = input.getBoundingClientRect();
+ sendMessage(['response-coords',
+ rect.left + 0.5 * rect.width,
+ rect.top + 0.5 * rect.height]);
+ }
+ });
+};
+
+init();
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698