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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3143 // to the frame's proxy in the bar.com (first frame's) process. | 3143 // to the frame's proxy in the bar.com (first frame's) process. |
3144 GURL frame_url = embedded_test_server()->GetURL("baz.com", "/title2.html"); | 3144 GURL frame_url = embedded_test_server()->GetURL("baz.com", "/title2.html"); |
3145 NavigateFrameToURL(root->child_at(1), frame_url); | 3145 NavigateFrameToURL(root->child_at(1), frame_url); |
3146 EXPECT_TRUE(observer.last_navigation_succeeded()); | 3146 EXPECT_TRUE(observer.last_navigation_succeeded()); |
3147 EXPECT_EQ(frame_url, observer.last_navigation_url()); | 3147 EXPECT_EQ(frame_url, observer.last_navigation_url()); |
3148 | 3148 |
3149 // The first frame can't directly observe the second frame's origin with | 3149 // The first frame can't directly observe the second frame's origin with |
3150 // JavaScript. Instead, try to navigate the second frame from the first | 3150 // JavaScript. Instead, try to navigate the second frame from the first |
3151 // frame. This should fail with a console error message, which should | 3151 // frame. This should fail with a console error message, which should |
3152 // contain the second frame's updated origin (see blink::Frame::canNavigate). | 3152 // contain the second frame's updated origin (see blink::Frame::canNavigate). |
3153 scoped_ptr<ConsoleObserverDelegate> console_delegate( | 3153 std::unique_ptr<ConsoleObserverDelegate> console_delegate( |
3154 new ConsoleObserverDelegate( | 3154 new ConsoleObserverDelegate( |
3155 shell()->web_contents(), | 3155 shell()->web_contents(), |
3156 "Unsafe JavaScript attempt to initiate navigation*")); | 3156 "Unsafe JavaScript attempt to initiate navigation*")); |
3157 shell()->web_contents()->SetDelegate(console_delegate.get()); | 3157 shell()->web_contents()->SetDelegate(console_delegate.get()); |
3158 | 3158 |
3159 // frames[1] can't be used due to a bug where RemoteFrames are created out of | 3159 // frames[1] can't be used due to a bug where RemoteFrames are created out of |
3160 // order (https://crbug.com/478792). Instead, target second frame by name. | 3160 // order (https://crbug.com/478792). Instead, target second frame by name. |
3161 EXPECT_TRUE(ExecuteScript( | 3161 EXPECT_TRUE(ExecuteScript( |
3162 root->child_at(0)->current_frame_host(), | 3162 root->child_at(0)->current_frame_host(), |
3163 "window.domAutomationController.send(" | 3163 "window.domAutomationController.send(" |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4698 "window.domAutomationController.send(getClickStatus());", &result)); | 4698 "window.domAutomationController.send(getClickStatus());", &result)); |
4699 EXPECT_EQ("0 clicks received", result); | 4699 EXPECT_EQ("0 clicks received", result); |
4700 } | 4700 } |
4701 | 4701 |
4702 // Simulate touch sequence to send GestureTap to sub-frame. | 4702 // Simulate touch sequence to send GestureTap to sub-frame. |
4703 SyntheticTapGestureParams params; | 4703 SyntheticTapGestureParams params; |
4704 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; | 4704 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; |
4705 gfx::Point center(150, 150); | 4705 gfx::Point center(150, 150); |
4706 params.position = gfx::PointF(center.x(), center.y()); | 4706 params.position = gfx::PointF(center.x(), center.y()); |
4707 params.duration_ms = 100; | 4707 params.duration_ms = 100; |
4708 scoped_ptr<SyntheticTapGesture> gesture(new SyntheticTapGesture(params)); | 4708 std::unique_ptr<SyntheticTapGesture> gesture(new SyntheticTapGesture(params)); |
4709 | 4709 |
4710 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); | 4710 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); |
4711 | 4711 |
4712 RenderWidgetHostImpl* render_widget_host = | 4712 RenderWidgetHostImpl* render_widget_host = |
4713 root->current_frame_host()->GetRenderWidgetHost(); | 4713 root->current_frame_host()->GetRenderWidgetHost(); |
4714 // TODO(wjmaclean): Convert the call to base::Bind() to a lambda someday. | 4714 // TODO(wjmaclean): Convert the call to base::Bind() to a lambda someday. |
4715 render_widget_host->QueueSyntheticGesture( | 4715 render_widget_host->QueueSyntheticGesture( |
4716 std::move(gesture), base::Bind(OnSyntheticGestureCompleted, runner)); | 4716 std::move(gesture), base::Bind(OnSyntheticGestureCompleted, runner)); |
4717 | 4717 |
4718 // We need to run the message loop while we wait for the synthetic gesture | 4718 // We need to run the message loop while we wait for the synthetic gesture |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6107 ->root(); | 6107 ->root(); |
6108 RenderWidgetHost* root_render_widget_host = | 6108 RenderWidgetHost* root_render_widget_host = |
6109 root->current_frame_host()->GetRenderWidgetHost(); | 6109 root->current_frame_host()->GetRenderWidgetHost(); |
6110 | 6110 |
6111 // Set the iframe to display: none. | 6111 // Set the iframe to display: none. |
6112 EXPECT_TRUE( | 6112 EXPECT_TRUE( |
6113 ExecuteScript(shell()->web_contents(), | 6113 ExecuteScript(shell()->web_contents(), |
6114 "document.querySelector('iframe').style.display = 'none'")); | 6114 "document.querySelector('iframe').style.display = 'none'")); |
6115 | 6115 |
6116 // Waits until pending frames are done. | 6116 // Waits until pending frames are done. |
6117 scoped_ptr<MainThreadFrameObserver> observer( | 6117 std::unique_ptr<MainThreadFrameObserver> observer( |
6118 new MainThreadFrameObserver(root_render_widget_host)); | 6118 new MainThreadFrameObserver(root_render_widget_host)); |
6119 observer->Wait(); | 6119 observer->Wait(); |
6120 | 6120 |
6121 // Force the renderer to generate a new frame. | 6121 // Force the renderer to generate a new frame. |
6122 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 6122 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
6123 "document.body.style.background = 'black'")); | 6123 "document.body.style.background = 'black'")); |
6124 | 6124 |
6125 // Waits for the next frame. | 6125 // Waits for the next frame. |
6126 observer->Wait(); | 6126 observer->Wait(); |
6127 } | 6127 } |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6527 root->current_frame_host()->GetRenderWidgetHost(); | 6527 root->current_frame_host()->GetRenderWidgetHost(); |
6528 press_tab_and_wait_for_state_change(root_rwh); | 6528 press_tab_and_wait_for_state_change(root_rwh); |
6529 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type); | 6529 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, contents->GetTextInputState()->type); |
6530 | 6530 |
6531 // Crash the tab renderer and observer the input state going back to none. | 6531 // Crash the tab renderer and observer the input state going back to none. |
6532 RenderProcessHost* host_process = root_rwh->GetProcess(); | 6532 RenderProcessHost* host_process = root_rwh->GetProcess(); |
6533 crash_renderer_and_wait_for_input_state_none(host_process); | 6533 crash_renderer_and_wait_for_input_state_none(host_process); |
6534 } | 6534 } |
6535 | 6535 |
6536 } // namespace content | 6536 } // namespace content |
OLD | NEW |