| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 4803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4814 // The third touch sequence should generate a GestureTapDown, sent to the | 4814 // The third touch sequence should generate a GestureTapDown, sent to the |
| 4815 // main frame. | 4815 // main frame. |
| 4816 SendGestureTapSequenceWithExpectedTarget(rwhv_parent, main_frame_point, | 4816 SendGestureTapSequenceWithExpectedTarget(rwhv_parent, main_frame_point, |
| 4817 router->gesture_target_, rwhv_child, | 4817 router->gesture_target_, rwhv_child, |
| 4818 rwhv_parent); | 4818 rwhv_parent); |
| 4819 EXPECT_EQ(0LU, router->gesture_target_queue_.size()); | 4819 EXPECT_EQ(0LU, router->gesture_target_queue_.size()); |
| 4820 EXPECT_EQ(rwhv_parent, router->gesture_target_); | 4820 EXPECT_EQ(rwhv_parent, router->gesture_target_); |
| 4821 } | 4821 } |
| 4822 #endif // defined(USE_AURA) | 4822 #endif // defined(USE_AURA) |
| 4823 | 4823 |
| 4824 // Ensure that a cross-process subframe can receive keyboard events when in | |
| 4825 // focus. Flaky: https://crbug.com/596508. | |
| 4826 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
| 4827 DISABLED_SubframeKeyboardEventRouting) { | |
| 4828 GURL main_url(embedded_test_server()->GetURL( | |
| 4829 "a.com", "/frame_tree/page_with_one_frame.html")); | |
| 4830 EXPECT_TRUE(NavigateToURL(shell(), main_url)); | |
| 4831 | |
| 4832 WebContentsImpl* web_contents = | |
| 4833 static_cast<WebContentsImpl*>(shell()->web_contents()); | |
| 4834 FrameTreeNode* root = web_contents->GetFrameTree()->root(); | |
| 4835 | |
| 4836 GURL frame_url( | |
| 4837 embedded_test_server()->GetURL("b.com", "/page_with_input_field.html")); | |
| 4838 NavigateFrameToURL(root->child_at(0), frame_url); | |
| 4839 | |
| 4840 // Focus the subframe and then its input field. The return value | |
| 4841 // "input-focus" will be sent once the input field's focus event fires. | |
| 4842 FocusFrame(root->child_at(0)); | |
| 4843 std::string result; | |
| 4844 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
| 4845 root->child_at(0)->current_frame_host(), "focusInputField()", &result)); | |
| 4846 EXPECT_EQ(result, "input-focus"); | |
| 4847 | |
| 4848 // The subframe should now be focused. | |
| 4849 EXPECT_EQ(root->child_at(0), root->frame_tree()->GetFocusedFrame()); | |
| 4850 | |
| 4851 // Generate a few keyboard events and route them to currently focused frame. | |
| 4852 SimulateKeyPress(web_contents, ui::VKEY_F, false, false, false, false); | |
| 4853 SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); | |
| 4854 SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); | |
| 4855 | |
| 4856 // Verify that the input field in the subframe received the keystrokes. | |
| 4857 EXPECT_TRUE(ExecuteScriptAndExtractString( | |
| 4858 root->child_at(0)->current_frame_host(), | |
| 4859 "window.domAutomationController.send(getInputFieldText());", &result)); | |
| 4860 EXPECT_EQ("FOO", result); | |
| 4861 } | |
| 4862 | |
| 4863 // Ensure that sequential focus navigation (advancing focused elements with | 4824 // Ensure that sequential focus navigation (advancing focused elements with |
| 4864 // <tab> and <shift-tab>) works across cross-process subframes. | 4825 // <tab> and <shift-tab>) works across cross-process subframes. |
| 4865 // The test sets up six inputs fields in a page with two cross-process | 4826 // The test sets up six inputs fields in a page with two cross-process |
| 4866 // subframes: | 4827 // subframes: |
| 4867 // child1 child2 | 4828 // child1 child2 |
| 4868 // /------------\ /------------\. | 4829 // /------------\ /------------\. |
| 4869 // | 2. <input> | | 4. <input> | | 4830 // | 2. <input> | | 4. <input> | |
| 4870 // 1. <input> | 3. <input> | | 5. <input> | 6. <input> | 4831 // 1. <input> | 3. <input> | | 5. <input> | 6. <input> |
| 4871 // \------------/ \------------/. | 4832 // \------------/ \------------/. |
| 4872 // | 4833 // |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6219 EXPECT_EQ(b_url, root->current_url()); | 6180 EXPECT_EQ(b_url, root->current_url()); |
| 6220 | 6181 |
| 6221 // Verify that the same RenderViewHost is preserved and that it is no longer | 6182 // Verify that the same RenderViewHost is preserved and that it is no longer |
| 6222 // in swapped out state. | 6183 // in swapped out state. |
| 6223 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( | 6184 EXPECT_EQ(rvh, contents->GetFrameTree()->GetRenderViewHost( |
| 6224 root->current_frame_host()->GetSiteInstance())); | 6185 root->current_frame_host()->GetSiteInstance())); |
| 6225 EXPECT_FALSE(rvh->is_swapped_out_); | 6186 EXPECT_FALSE(rvh->is_swapped_out_); |
| 6226 } | 6187 } |
| 6227 | 6188 |
| 6228 } // namespace content | 6189 } // namespace content |
| OLD | NEW |