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 5224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5235 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 5235 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
5236 root->child_at(0)->current_frame_host()->GetView()); | 5236 root->child_at(0)->current_frame_host()->GetView()); |
5237 SurfaceHitTestReadyNotifier notifier( | 5237 SurfaceHitTestReadyNotifier notifier( |
5238 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); | 5238 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); |
5239 notifier.WaitForSurfaceReady(); | 5239 notifier.WaitForSurfaceReady(); |
5240 | 5240 |
5241 // Simulate touch event to sub-frame. | 5241 // Simulate touch event to sub-frame. |
5242 gfx::Point child_center(150, 150); | 5242 gfx::Point child_center(150, 150); |
5243 auto* rwhv = static_cast<RenderWidgetHostViewAura*>( | 5243 auto* rwhv = static_cast<RenderWidgetHostViewAura*>( |
5244 contents->GetRenderWidgetHostView()); | 5244 contents->GetRenderWidgetHostView()); |
| 5245 |
| 5246 // Wait until renderer's compositor thread is synced. |
| 5247 RenderWidgetHost* child_render_widget_host = |
| 5248 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5249 { |
| 5250 std::unique_ptr<MainThreadFrameObserver> observer( |
| 5251 new MainThreadFrameObserver(child_render_widget_host)); |
| 5252 observer->Wait(); |
| 5253 } |
| 5254 |
5245 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, | 5255 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, |
5246 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); | 5256 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); |
5247 rwhv->OnTouchEvent(&touch_event); | 5257 rwhv->OnTouchEvent(&touch_event); |
| 5258 { |
| 5259 std::unique_ptr<MainThreadFrameObserver> observer( |
| 5260 new MainThreadFrameObserver(child_render_widget_host)); |
| 5261 observer->Wait(); |
| 5262 } |
5248 | 5263 |
5249 // Verify touch handler in subframe was invoked | 5264 // Verify touch handler in subframe was invoked |
5250 std::string result; | 5265 std::string result; |
5251 EXPECT_TRUE(ExecuteScriptAndExtractString( | 5266 EXPECT_TRUE(ExecuteScriptAndExtractString( |
5252 root->child_at(0), | 5267 root->child_at(0), |
5253 "window.domAutomationController.send(getLastTouchEvent());", &result)); | 5268 "window.domAutomationController.send(getLastTouchEvent());", &result)); |
5254 EXPECT_EQ("touchstart", result); | 5269 EXPECT_EQ("touchstart", result); |
5255 } | 5270 } |
5256 | 5271 |
5257 namespace { | 5272 namespace { |
(...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7894 // Verify child-RWHI gets TS/TE, GTD/GSB/GSE. | 7909 // Verify child-RWHI gets TS/TE, GTD/GSB/GSE. |
7895 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 7910 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
7896 EXPECT_EQ(blink::WebInputEvent::TouchStart, | 7911 EXPECT_EQ(blink::WebInputEvent::TouchStart, |
7897 child_frame_monitor.events_received()[0]); | 7912 child_frame_monitor.events_received()[0]); |
7898 EXPECT_EQ(blink::WebInputEvent::TouchEnd, | 7913 EXPECT_EQ(blink::WebInputEvent::TouchEnd, |
7899 child_frame_monitor.events_received()[1]); | 7914 child_frame_monitor.events_received()[1]); |
7900 EXPECT_EQ(blink::WebInputEvent::GestureTapDown, | 7915 EXPECT_EQ(blink::WebInputEvent::GestureTapDown, |
7901 child_frame_monitor.events_received()[2]); | 7916 child_frame_monitor.events_received()[2]); |
7902 EXPECT_EQ(blink::WebInputEvent::GestureScrollBegin, | 7917 EXPECT_EQ(blink::WebInputEvent::GestureScrollBegin, |
7903 child_frame_monitor.events_received()[3]); | 7918 child_frame_monitor.events_received()[3]); |
| 7919 EXPECT_EQ(blink::WebInputEvent::GesturePinchBegin, |
| 7920 child_frame_monitor.events_received()[4]); |
| 7921 EXPECT_EQ(blink::WebInputEvent::GesturePinchEnd, |
| 7922 child_frame_monitor.events_received()[5]); |
7904 EXPECT_EQ(blink::WebInputEvent::GestureScrollEnd, | 7923 EXPECT_EQ(blink::WebInputEvent::GestureScrollEnd, |
7905 child_frame_monitor.events_received()[4]); | 7924 child_frame_monitor.events_received()[6]); |
7906 } | 7925 } |
7907 | 7926 |
7908 IN_PROC_BROWSER_TEST_F(SitePerProcessGestureBrowserTest, | 7927 IN_PROC_BROWSER_TEST_F(SitePerProcessGestureBrowserTest, |
7909 MainframeGesturePinchGoesToMainFrame) { | 7928 MainframeGesturePinchGoesToMainFrame) { |
7910 SetupRootAndChild(); | 7929 SetupRootAndChild(); |
7911 | 7930 |
7912 TestInputEventObserver root_frame_monitor(rwhi_root_); | 7931 TestInputEventObserver root_frame_monitor(rwhi_root_); |
7913 TestInputEventObserver child_frame_monitor(rwhi_child_); | 7932 TestInputEventObserver child_frame_monitor(rwhi_child_); |
7914 | 7933 |
7915 // Need child rect in main frame coords. | 7934 // Need child rect in main frame coords. |
(...skipping 14 matching lines...) Expand all Loading... |
7930 root_frame_monitor.events_received()[2]); | 7949 root_frame_monitor.events_received()[2]); |
7931 EXPECT_EQ(blink::WebInputEvent::GestureScrollBegin, | 7950 EXPECT_EQ(blink::WebInputEvent::GestureScrollBegin, |
7932 root_frame_monitor.events_received()[3]); | 7951 root_frame_monitor.events_received()[3]); |
7933 EXPECT_EQ(blink::WebInputEvent::GesturePinchBegin, | 7952 EXPECT_EQ(blink::WebInputEvent::GesturePinchBegin, |
7934 root_frame_monitor.events_received()[4]); | 7953 root_frame_monitor.events_received()[4]); |
7935 EXPECT_EQ(blink::WebInputEvent::GesturePinchEnd, | 7954 EXPECT_EQ(blink::WebInputEvent::GesturePinchEnd, |
7936 root_frame_monitor.events_received()[5]); | 7955 root_frame_monitor.events_received()[5]); |
7937 EXPECT_EQ(blink::WebInputEvent::GestureScrollEnd, | 7956 EXPECT_EQ(blink::WebInputEvent::GestureScrollEnd, |
7938 root_frame_monitor.events_received()[6]); | 7957 root_frame_monitor.events_received()[6]); |
7939 | 7958 |
7940 // Verify child-RWHI gets no events. | 7959 // Verify child-RWHI also gets events. |
7941 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 7960 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 7961 EXPECT_EQ(blink::WebInputEvent::GesturePinchBegin, |
| 7962 child_frame_monitor.events_received()[0]); |
| 7963 EXPECT_EQ(blink::WebInputEvent::GesturePinchEnd, |
| 7964 child_frame_monitor.events_received()[1]); |
7942 } | 7965 } |
7943 #endif | 7966 #endif |
7944 | 7967 |
7945 // Test that the pending RenderFrameHost is canceled and destroyed when its | 7968 // Test that the pending RenderFrameHost is canceled and destroyed when its |
7946 // process dies. Previously, reusing a top-level pending RFH which | 7969 // process dies. Previously, reusing a top-level pending RFH which |
7947 // is not live was hitting a CHECK in CreateRenderView due to having neither a | 7970 // is not live was hitting a CHECK in CreateRenderView due to having neither a |
7948 // main frame routing ID nor a proxy routing ID. See https://crbug.com/627400 | 7971 // main frame routing ID nor a proxy routing ID. See https://crbug.com/627400 |
7949 // for more details. | 7972 // for more details. |
7950 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | 7973 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
7951 PendingRFHIsCanceledWhenItsProcessDies) { | 7974 PendingRFHIsCanceledWhenItsProcessDies) { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8526 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | 8549 EXPECT_TRUE(NavigateToURL(shell(), b_url)); |
8527 | 8550 |
8528 base::string16 expected_title(base::UTF8ToUTF16("foo")); | 8551 base::string16 expected_title(base::UTF8ToUTF16("foo")); |
8529 TitleWatcher title_watcher(popup2->web_contents(), expected_title); | 8552 TitleWatcher title_watcher(popup2->web_contents(), expected_title); |
8530 EXPECT_TRUE(ExecuteScript( | 8553 EXPECT_TRUE(ExecuteScript( |
8531 shell(), "window.open('','popup2').postMessage('foo', '*');")); | 8554 shell(), "window.open('','popup2').postMessage('foo', '*');")); |
8532 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 8555 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
8533 } | 8556 } |
8534 | 8557 |
8535 } // namespace content | 8558 } // namespace content |
OLD | NEW |