Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2101943004: content: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase/update Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4909 matching lines...) Expand 10 before | Expand all | Expand 10 after
4920 // Synchronize with the child and parent renderers to guarantee that the 4920 // Synchronize with the child and parent renderers to guarantee that the
4921 // surface information required for event hit testing is ready. 4921 // surface information required for event hit testing is ready.
4922 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 4922 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>(
4923 root->child_at(0)->current_frame_host()->GetView()); 4923 root->child_at(0)->current_frame_host()->GetView());
4924 SurfaceHitTestReadyNotifier notifier( 4924 SurfaceHitTestReadyNotifier notifier(
4925 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); 4925 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
4926 notifier.WaitForSurfaceReady(); 4926 notifier.WaitForSurfaceReady();
4927 4927
4928 // Simulate touch event to sub-frame. 4928 // Simulate touch event to sub-frame.
4929 gfx::Point child_center(150, 150); 4929 gfx::Point child_center(150, 150);
4930 auto rwhv = static_cast<RenderWidgetHostViewAura*>( 4930 auto* rwhv = static_cast<RenderWidgetHostViewAura*>(
4931 contents->GetRenderWidgetHostView()); 4931 contents->GetRenderWidgetHostView());
4932 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, 4932 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0,
4933 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); 4933 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f);
4934 rwhv->OnTouchEvent(&touch_event); 4934 rwhv->OnTouchEvent(&touch_event);
4935 4935
4936 // Verify touch handler in subframe was invoked 4936 // Verify touch handler in subframe was invoked
4937 std::string result; 4937 std::string result;
4938 EXPECT_TRUE(ExecuteScriptAndExtractString( 4938 EXPECT_TRUE(ExecuteScriptAndExtractString(
4939 root->child_at(0), 4939 root->child_at(0),
4940 "window.domAutomationController.send(getLastTouchEvent());", &result)); 4940 "window.domAutomationController.send(getLastTouchEvent());", &result));
(...skipping 22 matching lines...) Expand all
4963 GURL main_url(embedded_test_server()->GetURL( 4963 GURL main_url(embedded_test_server()->GetURL(
4964 "/frame_tree/page_with_positioned_nested_frames.html")); 4964 "/frame_tree/page_with_positioned_nested_frames.html"));
4965 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 4965 EXPECT_TRUE(NavigateToURL(shell(), main_url));
4966 4966
4967 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); 4967 FrameTreeNode* root = web_contents()->GetFrameTree()->root();
4968 ASSERT_EQ(1U, root->child_count()); 4968 ASSERT_EQ(1U, root->child_count());
4969 4969
4970 GURL frame_url( 4970 GURL frame_url(
4971 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 4971 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
4972 NavigateFrameToURL(root->child_at(0), frame_url); 4972 NavigateFrameToURL(root->child_at(0), frame_url);
4973 auto child_frame_host = root->child_at(0)->current_frame_host(); 4973 auto* child_frame_host = root->child_at(0)->current_frame_host();
4974 4974
4975 // Synchronize with the child and parent renderers to guarantee that the 4975 // Synchronize with the child and parent renderers to guarantee that the
4976 // surface information required for event hit testing is ready. 4976 // surface information required for event hit testing is ready.
4977 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( 4977 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>(
4978 child_frame_host->GetView()); 4978 child_frame_host->GetView());
4979 SurfaceHitTestReadyNotifier notifier( 4979 SurfaceHitTestReadyNotifier notifier(
4980 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); 4980 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv));
4981 notifier.WaitForSurfaceReady(); 4981 notifier.WaitForSurfaceReady();
4982 4982
4983 // There have been no GestureTaps sent yet. 4983 // There have been no GestureTaps sent yet.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5023 5023
5024 namespace { 5024 namespace {
5025 5025
5026 // Defined here to be close to 5026 // Defined here to be close to
5027 // SitePerProcessBrowserTest.InputEventRouterGestureTargetQueueTest. 5027 // SitePerProcessBrowserTest.InputEventRouterGestureTargetQueueTest.
5028 void SendTouchTapWithExpectedTarget( 5028 void SendTouchTapWithExpectedTarget(
5029 RenderWidgetHostViewBase* root_view, 5029 RenderWidgetHostViewBase* root_view,
5030 const gfx::Point& touch_point, 5030 const gfx::Point& touch_point,
5031 RenderWidgetHostViewBase*& router_touch_target, 5031 RenderWidgetHostViewBase*& router_touch_target,
5032 const RenderWidgetHostViewBase* expected_target) { 5032 const RenderWidgetHostViewBase* expected_target) {
5033 auto root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view); 5033 auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
5034 ui::TouchEvent touch_event_pressed(ui::ET_TOUCH_PRESSED, touch_point, 0, 5034 ui::TouchEvent touch_event_pressed(ui::ET_TOUCH_PRESSED, touch_point, 0,
5035 0, ui::EventTimeForNow(), 30.f, 30.f, 0.f, 5035 0, ui::EventTimeForNow(), 30.f, 30.f, 0.f,
5036 0.f); 5036 0.f);
5037 root_view_aura->OnTouchEvent(&touch_event_pressed); 5037 root_view_aura->OnTouchEvent(&touch_event_pressed);
5038 EXPECT_EQ(expected_target, router_touch_target); 5038 EXPECT_EQ(expected_target, router_touch_target);
5039 ui::TouchEvent touch_event_released(ui::ET_TOUCH_RELEASED, touch_point, 5039 ui::TouchEvent touch_event_released(ui::ET_TOUCH_RELEASED, touch_point,
5040 0, 0, ui::EventTimeForNow(), 30.f, 30.f, 5040 0, 0, ui::EventTimeForNow(), 30.f, 30.f,
5041 0.f, 0.f); 5041 0.f, 0.f);
5042 root_view_aura->OnTouchEvent(&touch_event_released); 5042 root_view_aura->OnTouchEvent(&touch_event_released);
5043 EXPECT_EQ(nullptr, router_touch_target); 5043 EXPECT_EQ(nullptr, router_touch_target);
5044 } 5044 }
5045 5045
5046 void SendGestureTapSequenceWithExpectedTarget( 5046 void SendGestureTapSequenceWithExpectedTarget(
5047 RenderWidgetHostViewBase* root_view, 5047 RenderWidgetHostViewBase* root_view,
5048 const gfx::Point& gesture_point, 5048 const gfx::Point& gesture_point,
5049 RenderWidgetHostViewBase*& router_gesture_target, 5049 RenderWidgetHostViewBase*& router_gesture_target,
5050 const RenderWidgetHostViewBase* old_expected_target, 5050 const RenderWidgetHostViewBase* old_expected_target,
5051 const RenderWidgetHostViewBase* expected_target) { 5051 const RenderWidgetHostViewBase* expected_target) {
5052 auto root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view); 5052 auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
5053 5053
5054 ui::GestureEventDetails gesture_begin_details(ui::ET_GESTURE_BEGIN); 5054 ui::GestureEventDetails gesture_begin_details(ui::ET_GESTURE_BEGIN);
5055 gesture_begin_details.set_device_type( 5055 gesture_begin_details.set_device_type(
5056 ui::GestureDeviceType::DEVICE_TOUCHSCREEN); 5056 ui::GestureDeviceType::DEVICE_TOUCHSCREEN);
5057 ui::GestureEvent gesture_begin_event(gesture_point.x(), gesture_point.y(), 0, 5057 ui::GestureEvent gesture_begin_event(gesture_point.x(), gesture_point.y(), 0,
5058 ui::EventTimeForNow(), 5058 ui::EventTimeForNow(),
5059 gesture_begin_details); 5059 gesture_begin_details);
5060 root_view_aura->OnGestureEvent(&gesture_begin_event); 5060 root_view_aura->OnGestureEvent(&gesture_begin_event);
5061 // We expect to still have the old gesture target in place for the 5061 // We expect to still have the old gesture target in place for the
5062 // GestureFlingCancel that will be inserted before GestureTapDown. 5062 // GestureFlingCancel that will be inserted before GestureTapDown.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5101 gesture_end_details); 5101 gesture_end_details);
5102 root_view_aura->OnGestureEvent(&gesture_end_event); 5102 root_view_aura->OnGestureEvent(&gesture_end_event);
5103 EXPECT_EQ(expected_target, router_gesture_target); 5103 EXPECT_EQ(expected_target, router_gesture_target);
5104 } 5104 }
5105 5105
5106 void SendTouchpadPinchSequenceWithExpectedTarget( 5106 void SendTouchpadPinchSequenceWithExpectedTarget(
5107 RenderWidgetHostViewBase* root_view, 5107 RenderWidgetHostViewBase* root_view,
5108 const gfx::Point& gesture_point, 5108 const gfx::Point& gesture_point,
5109 RenderWidgetHostViewBase*& router_touchpad_gesture_target, 5109 RenderWidgetHostViewBase*& router_touchpad_gesture_target,
5110 RenderWidgetHostViewBase* expected_target) { 5110 RenderWidgetHostViewBase* expected_target) {
5111 auto root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view); 5111 auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
5112 5112
5113 ui::GestureEventDetails pinch_begin_details(ui::ET_GESTURE_PINCH_BEGIN); 5113 ui::GestureEventDetails pinch_begin_details(ui::ET_GESTURE_PINCH_BEGIN);
5114 pinch_begin_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHPAD); 5114 pinch_begin_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHPAD);
5115 ui::GestureEvent pinch_begin(gesture_point.x(), gesture_point.y(), 0, 5115 ui::GestureEvent pinch_begin(gesture_point.x(), gesture_point.y(), 0,
5116 ui::EventTimeForNow(), pinch_begin_details); 5116 ui::EventTimeForNow(), pinch_begin_details);
5117 root_view_aura->OnGestureEvent(&pinch_begin); 5117 root_view_aura->OnGestureEvent(&pinch_begin);
5118 EXPECT_EQ(expected_target, router_touchpad_gesture_target); 5118 EXPECT_EQ(expected_target, router_touchpad_gesture_target);
5119 5119
5120 ui::GestureEventDetails pinch_update_details(ui::ET_GESTURE_PINCH_UPDATE); 5120 ui::GestureEventDetails pinch_update_details(ui::ET_GESTURE_PINCH_UPDATE);
5121 pinch_update_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHPAD); 5121 pinch_update_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHPAD);
(...skipping 10 matching lines...) Expand all
5132 EXPECT_EQ(expected_target, router_touchpad_gesture_target); 5132 EXPECT_EQ(expected_target, router_touchpad_gesture_target);
5133 } 5133 }
5134 5134
5135 #if !defined(OS_WIN) 5135 #if !defined(OS_WIN)
5136 // Sending touchpad fling events is not supported on Windows. 5136 // Sending touchpad fling events is not supported on Windows.
5137 void SendTouchpadFlingSequenceWithExpectedTarget( 5137 void SendTouchpadFlingSequenceWithExpectedTarget(
5138 RenderWidgetHostViewBase* root_view, 5138 RenderWidgetHostViewBase* root_view,
5139 const gfx::Point& gesture_point, 5139 const gfx::Point& gesture_point,
5140 RenderWidgetHostViewBase*& router_touchpad_gesture_target, 5140 RenderWidgetHostViewBase*& router_touchpad_gesture_target,
5141 RenderWidgetHostViewBase* expected_target) { 5141 RenderWidgetHostViewBase* expected_target) {
5142 auto root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view); 5142 auto* root_view_aura = static_cast<RenderWidgetHostViewAura*>(root_view);
5143 5143
5144 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, gesture_point, 5144 ui::ScrollEvent fling_start(ui::ET_SCROLL_FLING_START, gesture_point,
5145 ui::EventTimeForNow(), 0, 1, 0, 1, 0, 1); 5145 ui::EventTimeForNow(), 0, 1, 0, 1, 0, 1);
5146 root_view_aura->OnScrollEvent(&fling_start); 5146 root_view_aura->OnScrollEvent(&fling_start);
5147 EXPECT_EQ(expected_target, router_touchpad_gesture_target); 5147 EXPECT_EQ(expected_target, router_touchpad_gesture_target);
5148 5148
5149 ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL, gesture_point, 5149 ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL, gesture_point,
5150 ui::EventTimeForNow(), 0, 1, 0, 1, 0, 1); 5150 ui::EventTimeForNow(), 0, 1, 0, 1, 0, 1);
5151 root_view_aura->OnScrollEvent(&fling_cancel); 5151 root_view_aura->OnScrollEvent(&fling_cancel);
5152 EXPECT_EQ(expected_target, router_touchpad_gesture_target); 5152 EXPECT_EQ(expected_target, router_touchpad_gesture_target);
5153 } 5153 }
5154 #endif 5154 #endif
5155 5155
5156 } // namespace anonymous 5156 } // namespace anonymous
5157 5157
5158 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, 5158 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
5159 InputEventRouterGestureTargetQueueTest) { 5159 InputEventRouterGestureTargetQueueTest) {
5160 GURL main_url(embedded_test_server()->GetURL( 5160 GURL main_url(embedded_test_server()->GetURL(
5161 "/frame_tree/page_with_positioned_nested_frames.html")); 5161 "/frame_tree/page_with_positioned_nested_frames.html"));
5162 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 5162 EXPECT_TRUE(NavigateToURL(shell(), main_url));
5163 5163
5164 WebContentsImpl* contents = web_contents(); 5164 WebContentsImpl* contents = web_contents();
5165 FrameTreeNode* root = contents->GetFrameTree()->root(); 5165 FrameTreeNode* root = contents->GetFrameTree()->root();
5166 ASSERT_EQ(1U, root->child_count()); 5166 ASSERT_EQ(1U, root->child_count());
5167 5167
5168 GURL frame_url( 5168 GURL frame_url(
5169 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5169 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5170 NavigateFrameToURL(root->child_at(0), frame_url); 5170 NavigateFrameToURL(root->child_at(0), frame_url);
5171 auto child_frame_host = root->child_at(0)->current_frame_host(); 5171 auto* child_frame_host = root->child_at(0)->current_frame_host();
5172 5172
5173 // Synchronize with the child and parent renderers to guarantee that the 5173 // Synchronize with the child and parent renderers to guarantee that the
5174 // surface information required for event hit testing is ready. 5174 // surface information required for event hit testing is ready.
5175 auto rwhv_child = 5175 auto* rwhv_child =
5176 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); 5176 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
5177 SurfaceHitTestReadyNotifier notifier( 5177 SurfaceHitTestReadyNotifier notifier(
5178 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); 5178 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
5179 notifier.WaitForSurfaceReady(); 5179 notifier.WaitForSurfaceReady();
5180 5180
5181 // All touches & gestures are sent to the main frame's view, and should be 5181 // All touches & gestures are sent to the main frame's view, and should be
5182 // routed appropriately from there. 5182 // routed appropriately from there.
5183 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 5183 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
5184 contents->GetRenderWidgetHostView()); 5184 contents->GetRenderWidgetHostView());
5185 5185
5186 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 5186 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
5187 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty()); 5187 EXPECT_TRUE(router->touchscreen_gesture_target_queue_.empty());
5188 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target); 5188 EXPECT_EQ(nullptr, router->touchscreen_gesture_target_.target);
5189 5189
5190 // Send touch sequence to main-frame. 5190 // Send touch sequence to main-frame.
5191 gfx::Point main_frame_point(25, 25); 5191 gfx::Point main_frame_point(25, 25);
5192 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point, 5192 SendTouchTapWithExpectedTarget(rwhv_parent, main_frame_point,
5193 router->touch_target_.target, rwhv_parent); 5193 router->touch_target_.target, rwhv_parent);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5243 "/frame_tree/page_with_positioned_nested_frames.html")); 5243 "/frame_tree/page_with_positioned_nested_frames.html"));
5244 EXPECT_TRUE(NavigateToURL(shell(), main_url)); 5244 EXPECT_TRUE(NavigateToURL(shell(), main_url));
5245 5245
5246 WebContentsImpl* contents = web_contents(); 5246 WebContentsImpl* contents = web_contents();
5247 FrameTreeNode* root = contents->GetFrameTree()->root(); 5247 FrameTreeNode* root = contents->GetFrameTree()->root();
5248 ASSERT_EQ(1U, root->child_count()); 5248 ASSERT_EQ(1U, root->child_count());
5249 5249
5250 GURL frame_url( 5250 GURL frame_url(
5251 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html")); 5251 embedded_test_server()->GetURL("b.com", "/page_with_click_handler.html"));
5252 NavigateFrameToURL(root->child_at(0), frame_url); 5252 NavigateFrameToURL(root->child_at(0), frame_url);
5253 auto child_frame_host = root->child_at(0)->current_frame_host(); 5253 auto* child_frame_host = root->child_at(0)->current_frame_host();
5254 5254
5255 // Synchronize with the child and parent renderers to guarantee that the 5255 // Synchronize with the child and parent renderers to guarantee that the
5256 // surface information required for event hit testing is ready. 5256 // surface information required for event hit testing is ready.
5257 auto rwhv_child = 5257 auto* rwhv_child =
5258 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView()); 5258 static_cast<RenderWidgetHostViewBase*>(child_frame_host->GetView());
5259 SurfaceHitTestReadyNotifier notifier( 5259 SurfaceHitTestReadyNotifier notifier(
5260 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); 5260 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
5261 notifier.WaitForSurfaceReady(); 5261 notifier.WaitForSurfaceReady();
5262 5262
5263 // All touches & gestures are sent to the main frame's view, and should be 5263 // All touches & gestures are sent to the main frame's view, and should be
5264 // routed appropriately from there. 5264 // routed appropriately from there.
5265 auto rwhv_parent = static_cast<RenderWidgetHostViewBase*>( 5265 auto* rwhv_parent = static_cast<RenderWidgetHostViewBase*>(
5266 contents->GetRenderWidgetHostView()); 5266 contents->GetRenderWidgetHostView());
5267 5267
5268 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter(); 5268 RenderWidgetHostInputEventRouter* router = contents->GetInputEventRouter();
5269 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target); 5269 EXPECT_EQ(nullptr, router->touchpad_gesture_target_.target);
5270 5270
5271 gfx::Point main_frame_point(25, 25); 5271 gfx::Point main_frame_point(25, 25);
5272 gfx::Point child_center(150, 150); 5272 gfx::Point child_center(150, 150);
5273 5273
5274 // Send touchpad pinch sequence to main-frame. 5274 // Send touchpad pinch sequence to main-frame.
5275 SendTouchpadPinchSequenceWithExpectedTarget( 5275 SendTouchpadPinchSequenceWithExpectedTarget(
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
7502 7502
7503 shell()->web_contents()->WasShown(); 7503 shell()->web_contents()->WasShown();
7504 7504
7505 EXPECT_TRUE(ExecuteScriptAndExtractInt( 7505 EXPECT_TRUE(ExecuteScriptAndExtractInt(
7506 root->child_at(0)->current_frame_host(), 7506 root->child_at(0)->current_frame_host(),
7507 "window.domAutomationController.send(event_fired);", &event_fired)); 7507 "window.domAutomationController.send(event_fired);", &event_fired));
7508 EXPECT_EQ(2, event_fired); 7508 EXPECT_EQ(2, event_fired);
7509 } 7509 }
7510 7510
7511 } // namespace content 7511 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/text_input_manager.cc ('k') | content/browser/tracing/background_tracing_config_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698