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

Unified Diff: LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus.html

Issue 292973007: DevTools: Focus/blur events that are triggered by DevTools get dispatched when page is unfocused (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « no previous file | LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus.html
diff --git a/LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus.html b/LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..2488707ed0dd0bc2f14f6fc2583f599c25421502
--- /dev/null
+++ b/LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus.html
@@ -0,0 +1,79 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+
+function load()
+{
+ window.internals.setFocused(false);
+ runTest();
+}
+
+function dump()
+{
+ log("================");
+ log("value of foo:" + document.getElementById("foo").value);
+ log("value of bar:" + document.getElementById("bar").value);
+ log("value of baz:" + document.getElementById("baz").value);
+ window.internals.setFocused(true);
dgozman 2014/05/22 12:45:47 Events you dispatch should have already focused th
vsevik 2014/05/22 13:14:40 I think this is done to make sure the test is not
+}
+
+function test()
+{
+ type("foo");
+ typeTab();
+ type("bar");
+ typeTab();
+ InspectorTest.executeInPage("dump()", InspectorTest.completeTest.bind(InspectorTest));
+
+ function type(text)
+ {
+ for (var i = 0; i < text.length; ++i) {
+ var dec = text.charCodeAt(i);
+ var hex = "U+00" + Number(dec).toString(16);
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "rawKeyDown",
+ "windowsVirtualKeyCode": dec,
+ "keyIdentifier": hex
+ });
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "char",
+ "text": text[i],
+ "unmodifiedText": text[i]
+ });
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "keyUp",
+ "windowsVirtualKeyCode": dec,
+ "keyIdentifier": hex
+ });
+ }
+ }
+
+ function typeTab()
+ {
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "rawKeyDown",
+ "windowsVirtualKeyCode": 9,
+ "keyIdentifier": "U+0009"
+ });
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "char"
+ });
+ InspectorTest.sendCommand("Input.dispatchKeyEvent", {
+ "type": "keyUp",
+ "windowsVirtualKeyCode": 9,
+ "keyIdentifier": "U+0009"
+ });
+ }
+}
+
+</script>
+</head>
+<body onload="load()">
+<div id="inputs">
+ <input onfocus="log('focus foo')" onblur="log('blur foo')" id="foo" autofocus>
+ <input onfocus="log('focus bar')" onblur="log('blur bar')" id="bar">
+ <input onfocus="log('focus baz')" onblur="log('blur baz')" id="baz">
+</div>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/input/dispatchKeyEvent-focus-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698