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

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

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix mac/win errors Created 4 years, 4 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 &success)); 126 &success));
127 EXPECT_TRUE(success); 127 EXPECT_TRUE(success);
128 } 128 }
129 129
130 // Helper function to generate a click on the given RenderWidgetHost. The 130 // Helper function to generate a click on the given RenderWidgetHost. The
131 // mouse event is forwarded directly to the RenderWidgetHost without any 131 // mouse event is forwarded directly to the RenderWidgetHost without any
132 // hit-testing. 132 // hit-testing.
133 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { 133 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) {
134 blink::WebMouseEvent mouse_event; 134 blink::WebMouseEvent mouse_event;
135 mouse_event.type = blink::WebInputEvent::MouseDown; 135 mouse_event.type = blink::WebInputEvent::MouseDown;
136 mouse_event.button = blink::WebPointerProperties::ButtonLeft; 136 mouse_event.button = blink::WebPointerProperties::Button::Left;
137 mouse_event.x = x; 137 mouse_event.x = x;
138 mouse_event.y = y; 138 mouse_event.y = y;
139 rwh->ForwardMouseEvent(mouse_event); 139 rwh->ForwardMouseEvent(mouse_event);
140 } 140 }
141 141
142 // Retrieve document.origin for the frame |ftn|. 142 // Retrieve document.origin for the frame |ftn|.
143 std::string GetDocumentOrigin(FrameTreeNode* ftn) { 143 std::string GetDocumentOrigin(FrameTreeNode* ftn) {
144 std::string origin; 144 std::string origin;
145 EXPECT_TRUE(ExecuteScriptAndExtractString( 145 EXPECT_TRUE(ExecuteScriptAndExtractString(
146 ftn, "domAutomationController.send(document.origin)", &origin)); 146 ftn, "domAutomationController.send(document.origin)", &origin));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 241 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
242 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 242 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
243 243
244 SurfaceHitTestReadyNotifier notifier( 244 SurfaceHitTestReadyNotifier notifier(
245 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); 245 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
246 notifier.WaitForSurfaceReady(); 246 notifier.WaitForSurfaceReady();
247 247
248 // Target input event to child frame. 248 // Target input event to child frame.
249 blink::WebMouseEvent child_event; 249 blink::WebMouseEvent child_event;
250 child_event.type = blink::WebInputEvent::MouseDown; 250 child_event.type = blink::WebInputEvent::MouseDown;
251 child_event.button = blink::WebPointerProperties::ButtonLeft; 251 child_event.button = blink::WebPointerProperties::Button::Left;
252 child_event.x = 75; 252 child_event.x = 75;
253 child_event.y = 75; 253 child_event.y = 75;
254 child_event.clickCount = 1; 254 child_event.clickCount = 1;
255 main_frame_monitor.ResetEventReceived(); 255 main_frame_monitor.ResetEventReceived();
256 child_frame_monitor.ResetEventReceived(); 256 child_frame_monitor.ResetEventReceived();
257 router->RouteMouseEvent(root_view, &child_event); 257 router->RouteMouseEvent(root_view, &child_event);
258 258
259 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 259 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
260 EXPECT_EQ(23, child_frame_monitor.event().x); 260 EXPECT_EQ(23, child_frame_monitor.event().x);
261 EXPECT_EQ(23, child_frame_monitor.event().y); 261 EXPECT_EQ(23, child_frame_monitor.event().y);
262 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 262 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
263 263
264 child_frame_monitor.ResetEventReceived(); 264 child_frame_monitor.ResetEventReceived();
265 main_frame_monitor.ResetEventReceived(); 265 main_frame_monitor.ResetEventReceived();
266 266
267 // Target input event to main frame. 267 // Target input event to main frame.
268 blink::WebMouseEvent main_event; 268 blink::WebMouseEvent main_event;
269 main_event.type = blink::WebInputEvent::MouseDown; 269 main_event.type = blink::WebInputEvent::MouseDown;
270 main_event.button = blink::WebPointerProperties::ButtonLeft; 270 main_event.button = blink::WebPointerProperties::Button::Left;
271 main_event.x = 1; 271 main_event.x = 1;
272 main_event.y = 1; 272 main_event.y = 1;
273 main_event.clickCount = 1; 273 main_event.clickCount = 1;
274 // Ladies and gentlemen, THIS is the main_event! 274 // Ladies and gentlemen, THIS is the main_event!
275 router->RouteMouseEvent(root_view, &main_event); 275 router->RouteMouseEvent(root_view, &main_event);
276 276
277 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 277 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
278 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 278 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
279 EXPECT_EQ(1, main_frame_monitor.event().x); 279 EXPECT_EQ(1, main_frame_monitor.event().x);
280 EXPECT_EQ(1, main_frame_monitor.event().y); 280 EXPECT_EQ(1, main_frame_monitor.event().y);
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 ->GetRenderWidgetHost() 1211 ->GetRenderWidgetHost()
1212 ->GetView()); 1212 ->GetView());
1213 1213
1214 SurfaceHitTestReadyNotifier notifier( 1214 SurfaceHitTestReadyNotifier notifier(
1215 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested)); 1215 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_nested));
1216 notifier.WaitForSurfaceReady(); 1216 notifier.WaitForSurfaceReady();
1217 1217
1218 // Target input event to nested frame. 1218 // Target input event to nested frame.
1219 blink::WebMouseEvent nested_event; 1219 blink::WebMouseEvent nested_event;
1220 nested_event.type = blink::WebInputEvent::MouseDown; 1220 nested_event.type = blink::WebInputEvent::MouseDown;
1221 nested_event.button = blink::WebPointerProperties::ButtonLeft; 1221 nested_event.button = blink::WebPointerProperties::Button::Left;
1222 nested_event.x = 125; 1222 nested_event.x = 125;
1223 nested_event.y = 125; 1223 nested_event.y = 125;
1224 nested_event.clickCount = 1; 1224 nested_event.clickCount = 1;
1225 nested_frame_monitor.ResetEventReceived(); 1225 nested_frame_monitor.ResetEventReceived();
1226 main_frame_monitor.ResetEventReceived(); 1226 main_frame_monitor.ResetEventReceived();
1227 router->RouteMouseEvent(root_view, &nested_event); 1227 router->RouteMouseEvent(root_view, &nested_event);
1228 1228
1229 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); 1229 EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
1230 EXPECT_EQ(21, nested_frame_monitor.event().x); 1230 EXPECT_EQ(21, nested_frame_monitor.event().x);
1231 EXPECT_EQ(21, nested_frame_monitor.event().y); 1231 EXPECT_EQ(21, nested_frame_monitor.event().y);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( 1276 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1277 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); 1277 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1278 1278
1279 SurfaceHitTestReadyNotifier notifier( 1279 SurfaceHitTestReadyNotifier notifier(
1280 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child)); 1280 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1281 notifier.WaitForSurfaceReady(); 1281 notifier.WaitForSurfaceReady();
1282 1282
1283 // Target input event to child frame. 1283 // Target input event to child frame.
1284 blink::WebMouseEvent child_event; 1284 blink::WebMouseEvent child_event;
1285 child_event.type = blink::WebInputEvent::MouseDown; 1285 child_event.type = blink::WebInputEvent::MouseDown;
1286 child_event.button = blink::WebPointerProperties::ButtonLeft; 1286 child_event.button = blink::WebPointerProperties::Button::Left;
1287 child_event.x = 75; 1287 child_event.x = 75;
1288 child_event.y = 75; 1288 child_event.y = 75;
1289 child_event.clickCount = 1; 1289 child_event.clickCount = 1;
1290 main_frame_monitor.ResetEventReceived(); 1290 main_frame_monitor.ResetEventReceived();
1291 child_frame_monitor.ResetEventReceived(); 1291 child_frame_monitor.ResetEventReceived();
1292 router->RouteMouseEvent(root_view, &child_event); 1292 router->RouteMouseEvent(root_view, &child_event);
1293 1293
1294 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1294 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1295 EXPECT_EQ(75, main_frame_monitor.event().x); 1295 EXPECT_EQ(75, main_frame_monitor.event().x);
1296 EXPECT_EQ(75, main_frame_monitor.event().y); 1296 EXPECT_EQ(75, main_frame_monitor.event().y);
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after
5374 5374
5375 RenderWidgetHostInputEventRouter* router = 5375 RenderWidgetHostInputEventRouter* router =
5376 static_cast<WebContentsImpl*>(shell->web_contents()) 5376 static_cast<WebContentsImpl*>(shell->web_contents())
5377 ->GetInputEventRouter(); 5377 ->GetInputEventRouter();
5378 5378
5379 gfx::Point point(75, 75); 5379 gfx::Point point(75, 75);
5380 5380
5381 // Target right-click event to child frame. 5381 // Target right-click event to child frame.
5382 blink::WebMouseEvent click_event; 5382 blink::WebMouseEvent click_event;
5383 click_event.type = blink::WebInputEvent::MouseDown; 5383 click_event.type = blink::WebInputEvent::MouseDown;
5384 click_event.button = blink::WebPointerProperties::ButtonRight; 5384 click_event.button = blink::WebPointerProperties::Button::Right;
5385 click_event.x = point.x(); 5385 click_event.x = point.x();
5386 click_event.y = point.y(); 5386 click_event.y = point.y();
5387 click_event.clickCount = 1; 5387 click_event.clickCount = 1;
5388 router->RouteMouseEvent(root_view, &click_event); 5388 router->RouteMouseEvent(root_view, &click_event);
5389 5389
5390 // We also need a MouseUp event, needed by Windows. 5390 // We also need a MouseUp event, needed by Windows.
5391 click_event.type = blink::WebInputEvent::MouseUp; 5391 click_event.type = blink::WebInputEvent::MouseUp;
5392 click_event.x = point.x(); 5392 click_event.x = point.x();
5393 click_event.y = point.y(); 5393 click_event.y = point.y();
5394 router->RouteMouseEvent(root_view, &click_event); 5394 router->RouteMouseEvent(root_view, &click_event);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
5529 5529
5530 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 5530 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
5531 child_node->current_frame_host()->GetSiteInstance()); 5531 child_node->current_frame_host()->GetSiteInstance());
5532 5532
5533 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 5533 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
5534 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 5534 child_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
5535 5535
5536 // Target left-click event to child frame. 5536 // Target left-click event to child frame.
5537 blink::WebMouseEvent click_event; 5537 blink::WebMouseEvent click_event;
5538 click_event.type = blink::WebInputEvent::MouseDown; 5538 click_event.type = blink::WebInputEvent::MouseDown;
5539 click_event.button = blink::WebPointerProperties::ButtonLeft; 5539 click_event.button = blink::WebPointerProperties::Button::Left;
5540 click_event.x = 15; 5540 click_event.x = 15;
5541 click_event.y = 15; 5541 click_event.y = 15;
5542 click_event.clickCount = 1; 5542 click_event.clickCount = 1;
5543 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5543 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
5544 5544
5545 // Dismiss the popup. 5545 // Dismiss the popup.
5546 click_event.x = 1; 5546 click_event.x = 1;
5547 click_event.y = 1; 5547 click_event.y = 1;
5548 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5548 rwhv_child->ProcessMouseEvent(click_event, ui::LatencyInfo());
5549 5549
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
5604 5604
5605 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), 5605 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
5606 c_node->current_frame_host()->GetSiteInstance()); 5606 c_node->current_frame_host()->GetSiteInstance());
5607 5607
5608 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter(); 5608 scoped_refptr<ShowWidgetMessageFilter> filter = new ShowWidgetMessageFilter();
5609 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get()); 5609 c_node->current_frame_host()->GetProcess()->AddFilter(filter.get());
5610 5610
5611 // Target left-click event to child frame. 5611 // Target left-click event to child frame.
5612 blink::WebMouseEvent click_event; 5612 blink::WebMouseEvent click_event;
5613 click_event.type = blink::WebInputEvent::MouseDown; 5613 click_event.type = blink::WebInputEvent::MouseDown;
5614 click_event.button = blink::WebPointerProperties::ButtonLeft; 5614 click_event.button = blink::WebPointerProperties::Button::Left;
5615 click_event.x = 15; 5615 click_event.x = 15;
5616 click_event.y = 15; 5616 click_event.y = 15;
5617 click_event.clickCount = 1; 5617 click_event.clickCount = 1;
5618 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5618 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
5619 5619
5620 // Prompt the WebContents to dismiss the popup by clicking elsewhere. 5620 // Prompt the WebContents to dismiss the popup by clicking elsewhere.
5621 click_event.x = 1; 5621 click_event.x = 1;
5622 click_event.y = 1; 5622 click_event.y = 1;
5623 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5623 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
5624 5624
(...skipping 29 matching lines...) Expand all
5654 while (last_b_node_bounds_rect.x() == 5654 while (last_b_node_bounds_rect.x() ==
5655 b_node->current_frame_host()->GetView()->GetViewBounds().x() && 5655 b_node->current_frame_host()->GetView()->GetViewBounds().x() &&
5656 last_b_node_bounds_rect.y() == 5656 last_b_node_bounds_rect.y() ==
5657 b_node->current_frame_host()->GetView()->GetViewBounds().y()) { 5657 b_node->current_frame_host()->GetView()->GetViewBounds().y()) {
5658 base::RunLoop run_loop; 5658 base::RunLoop run_loop;
5659 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 5659 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
5660 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); 5660 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
5661 run_loop.Run(); 5661 run_loop.Run();
5662 } 5662 }
5663 5663
5664 click_event.button = blink::WebPointerProperties::ButtonLeft; 5664 click_event.button = blink::WebPointerProperties::Button::Left;
5665 click_event.x = 15; 5665 click_event.x = 15;
5666 click_event.y = 15; 5666 click_event.y = 15;
5667 click_event.clickCount = 1; 5667 click_event.clickCount = 1;
5668 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5668 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
5669 5669
5670 click_event.x = 1; 5670 click_event.x = 1;
5671 click_event.y = 1; 5671 click_event.y = 1;
5672 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo()); 5672 rwhv_c_node->ProcessMouseEvent(click_event, ui::LatencyInfo());
5673 5673
5674 filter->Wait(); 5674 filter->Wait();
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
7756 // https://crbug.com/627893, recreating the opener RenderView was hitting a 7756 // https://crbug.com/627893, recreating the opener RenderView was hitting a
7757 // CHECK(params.swapped_out) in the renderer process, since its 7757 // CHECK(params.swapped_out) in the renderer process, since its
7758 // RenderViewHost was brought into an active state by the navigation to 7758 // RenderViewHost was brought into an active state by the navigation to
7759 // |stall_url| above, even though it never committed. 7759 // |stall_url| above, even though it never committed.
7760 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html")); 7760 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html"));
7761 EXPECT_TRUE(NavigateToURL(popup_shell, b_url)); 7761 EXPECT_TRUE(NavigateToURL(popup_shell, b_url));
7762 EXPECT_FALSE(rvh->is_active()); 7762 EXPECT_FALSE(rvh->is_active());
7763 } 7763 }
7764 7764
7765 } // namespace content 7765 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698