OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 SendCommand("Input.dispatchMouseEvent", std::move(params), wait); | 440 SendCommand("Input.dispatchMouseEvent", std::move(params), wait); |
441 } | 441 } |
442 }; | 442 }; |
443 | 443 |
444 IN_PROC_BROWSER_TEST_F(SyntheticKeyEventTest, KeyEventSynthesizeKey) { | 444 IN_PROC_BROWSER_TEST_F(SyntheticKeyEventTest, KeyEventSynthesizeKey) { |
445 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); | 445 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
446 Attach(); | 446 Attach(); |
447 ASSERT_TRUE(content::ExecuteScript( | 447 ASSERT_TRUE(content::ExecuteScript( |
448 shell()->web_contents()->GetRenderViewHost(), | 448 shell()->web_contents()->GetRenderViewHost(), |
449 "function handleKeyEvent(event) {" | 449 "function handleKeyEvent(event) {" |
450 "domAutomationController.setAutomationId(0);" | |
451 "domAutomationController.send(event.key);" | 450 "domAutomationController.send(event.key);" |
452 "}" | 451 "}" |
453 "document.body.addEventListener('keydown', handleKeyEvent);" | 452 "document.body.addEventListener('keydown', handleKeyEvent);" |
454 "document.body.addEventListener('keyup', handleKeyEvent);")); | 453 "document.body.addEventListener('keyup', handleKeyEvent);")); |
455 | 454 |
456 DOMMessageQueue dom_message_queue; | 455 DOMMessageQueue dom_message_queue; |
457 | 456 |
458 // Send enter (keycode 13). | 457 // Send enter (keycode 13). |
459 SendKeyEvent("rawKeyDown", 0, 13, 13, "Enter", true); | 458 SendKeyEvent("rawKeyDown", 0, 13, 13, "Enter", true); |
460 SendKeyEvent("keyUp", 0, 13, 13, "Enter", true); | 459 SendKeyEvent("keyUp", 0, 13, 13, "Enter", true); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 EXPECT_EQ("polyglottal", value); | 1843 EXPECT_EQ("polyglottal", value); |
1845 found++; | 1844 found++; |
1846 } else { | 1845 } else { |
1847 FAIL(); | 1846 FAIL(); |
1848 } | 1847 } |
1849 } | 1848 } |
1850 EXPECT_EQ(2u, found); | 1849 EXPECT_EQ(2u, found); |
1851 } | 1850 } |
1852 | 1851 |
1853 } // namespace content | 1852 } // namespace content |
OLD | NEW |