Chromium Code Reviews| 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 "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 if (GetParam()) | 663 if (GetParam()) |
| 664 return; | 664 return; |
| 665 TestHelper("testFocusBeforeNavigation", "web_view/focus", NO_TEST_SERVER); | 665 TestHelper("testFocusBeforeNavigation", "web_view/focus", NO_TEST_SERVER); |
| 666 } | 666 } |
| 667 | 667 |
| 668 // Tests that setting focus on the <webview> sets focus on the guest. | 668 // Tests that setting focus on the <webview> sets focus on the guest. |
| 669 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusEvent) { | 669 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusEvent) { |
| 670 TestHelper("testFocusEvent", "web_view/focus", NO_TEST_SERVER); | 670 TestHelper("testFocusEvent", "web_view/focus", NO_TEST_SERVER); |
| 671 } | 671 } |
| 672 | 672 |
| 673 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTakeFocus) { | |
|
alexmos
2017/03/10 07:08:33
Since this is also a problem for OOPIFs without <w
avallee
2017/03/13 19:18:10
Let me add this in then. Just to be clear, I think
alexmos
2017/03/16 17:37:11
Yes, exactly. I'm just thinking of following the
avallee
2017/05/10 18:42:16
Test created and enabled (flaky but quite rarely)
| |
| 674 TestHelper("testFocusTakeFocus", "web_view/focus", NO_TEST_SERVER); | |
| 675 | |
| 676 // Compute where to click in the window to focus the guest input box. | |
| 677 int clickX, clickY; | |
| 678 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | |
| 679 embedder_web_contents(), | |
| 680 "domAutomationController.send(Math.floor(window.clickX));", &clickX)); | |
| 681 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | |
| 682 embedder_web_contents(), | |
| 683 "domAutomationController.send(Math.floor(window.clickY));", &clickY)); | |
| 684 | |
| 685 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false); | |
| 686 next_step_listener.set_failure_message("TEST_STEP_FAILED"); | |
| 687 content::SimulateMouseClickAt( | |
| 688 (GetParam() ? guest_web_contents() : embedder_web_contents()), 0, | |
| 689 blink::WebMouseEvent::Button::Left, gfx::Point(clickX, clickY)); | |
| 690 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); | |
| 691 | |
| 692 // TAB back out to the embedder's input. | |
| 693 next_step_listener.Reset(); | |
| 694 content::SimulateKeyPress(embedder_web_contents(), ui::DomKey::TAB, | |
| 695 ui::DomCode::TAB, ui::VKEY_TAB, false, false, false, | |
| 696 false); | |
| 697 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); | |
| 698 } | |
| 699 | |
| 673 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTracksEmbedder) { | 700 IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTracksEmbedder) { |
| 674 content::WebContents* embedder_web_contents = NULL; | 701 content::WebContents* embedder_web_contents = NULL; |
| 675 | 702 |
| 676 std::unique_ptr<ExtensionTestMessageListener> done_listener( | 703 std::unique_ptr<ExtensionTestMessageListener> done_listener( |
| 677 RunAppHelper("testFocusTracksEmbedder", "web_view/focus", NO_TEST_SERVER, | 704 RunAppHelper("testFocusTracksEmbedder", "web_view/focus", NO_TEST_SERVER, |
| 678 &embedder_web_contents)); | 705 &embedder_web_contents)); |
| 679 done_listener->WaitUntilSatisfied(); | 706 done_listener->WaitUntilSatisfied(); |
| 680 | 707 |
| 681 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false); | 708 ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false); |
| 682 next_step_listener.set_failure_message("TEST_STEP_FAILED"); | 709 next_step_listener.set_failure_message("TEST_STEP_FAILED"); |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 1527 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
| 1501 GetPlatformAppWindow(), ui::VKEY_Z, false, false, false, false)); | 1528 GetPlatformAppWindow(), ui::VKEY_Z, false, false, false, false)); |
| 1502 | 1529 |
| 1503 next_step_listener.Reset(); | 1530 next_step_listener.Reset(); |
| 1504 EXPECT_TRUE(content::ExecuteScript( | 1531 EXPECT_TRUE(content::ExecuteScript( |
| 1505 embedder_web_contents(), | 1532 embedder_web_contents(), |
| 1506 "window.runCommand('testKeyboardFocusRunNextStep', 'aBcxYz');")); | 1533 "window.runCommand('testKeyboardFocusRunNextStep', 'aBcxYz');")); |
| 1507 | 1534 |
| 1508 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); | 1535 ASSERT_TRUE(next_step_listener.WaitUntilSatisfied()); |
| 1509 } | 1536 } |
| OLD | NEW |