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

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

Issue 1416173002: Fix flaky SitePerProcessBrowserTest.SurfaceHitTestTest test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 event_ = event; 469 event_ = event;
470 return false; 470 return false;
471 } 471 }
472 RenderWidgetHost* host_; 472 RenderWidgetHost* host_;
473 bool event_received; 473 bool event_received;
474 blink::WebMouseEvent event_; 474 blink::WebMouseEvent event_;
475 }; 475 };
476 476
477 // Test that mouse events are being routed to the correct RenderWidgetHostView 477 // Test that mouse events are being routed to the correct RenderWidgetHostView
478 // based on coordinates. 478 // based on coordinates.
479 #if defined(OS_ANDROID) || defined(THREAD_SANITIZER) || defined(OS_LINUX) 479 #if defined(OS_ANDROID)
480 // Browser process hit testing is not implemented on Android. 480 // Browser process hit testing is not implemented on Android.
481 // https://crbug.com/491334 481 // https://crbug.com/491334
482 // Test fails under TSAN, see https://crbug.com/527618
483 // Test is flaky under Linux, see https://crbug.com/528189
484 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest 482 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest
485 #else 483 #else
486 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest 484 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest
487 #endif 485 #endif
488 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { 486 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) {
489 if (!UseSurfacesEnabled()) 487 if (!UseSurfacesEnabled())
490 return; 488 return;
491 489
492 GURL main_url(embedded_test_server()->GetURL( 490 GURL main_url(embedded_test_server()->GetURL(
493 "/frame_tree/page_with_positioned_frame.html")); 491 "/frame_tree/page_with_positioned_frame.html"));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 532
535 uint32_t cur_render_frame_number = root_view->RendererFrameNumber(); 533 uint32_t cur_render_frame_number = root_view->RendererFrameNumber();
536 534
537 // Target input event to child frame. 535 // Target input event to child frame.
538 blink::WebMouseEvent child_event; 536 blink::WebMouseEvent child_event;
539 child_event.type = blink::WebInputEvent::MouseDown; 537 child_event.type = blink::WebInputEvent::MouseDown;
540 child_event.button = blink::WebPointerProperties::ButtonLeft; 538 child_event.button = blink::WebPointerProperties::ButtonLeft;
541 child_event.x = 75; 539 child_event.x = 75;
542 child_event.y = 75; 540 child_event.y = 75;
543 child_event.clickCount = 1; 541 child_event.clickCount = 1;
542 main_frame_monitor.ResetEventReceived();
543 child_frame_monitor.ResetEventReceived();
544 router->RouteMouseEvent(root_view, &child_event); 544 router->RouteMouseEvent(root_view, &child_event);
545 545
546 if (!child_frame_monitor.EventWasReceived()) { 546 while (!child_frame_monitor.EventWasReceived()) {
547 main_frame_monitor.ResetEventReceived(); 547 main_frame_monitor.ResetEventReceived();
548 // This is working around a big synchronization problem. It is very 548 // This is working around a big synchronization problem. It is very
549 // difficult to know if we have received a compositor frame from the 549 // difficult to know if we have received a compositor frame from the
550 // main frame renderer *after* it received the child frame's surface 550 // main frame renderer *after* it received the child frame's surface
551 // ID. Hit testing won't work until this happens. So if the hit test 551 // ID. Hit testing won't work until this happens. So if the hit test
552 // fails then we wait for another frame to arrive and try again. 552 // fails then we wait for another frame to arrive and try again.
553 // TODO(kenrb): We need a better way to do all of this, possibly coming 553 // TODO(kenrb): We need a better way to do all of this, possibly coming
554 // from http://crbug.com/405282. 554 // from http://crbug.com/405282.
555 while (root_view->RendererFrameNumber() <= cur_render_frame_number) { 555 while (root_view->RendererFrameNumber() <= cur_render_frame_number) {
556 base::RunLoop run_loop; 556 base::RunLoop run_loop;
557 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 557 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
558 FROM_HERE, run_loop.QuitClosure(), 558 FROM_HERE, run_loop.QuitClosure(),
559 base::TimeDelta::FromMilliseconds(10)); 559 base::TimeDelta::FromMilliseconds(10));
560 run_loop.Run(); 560 run_loop.Run();
561 } 561 }
562 cur_render_frame_number = root_view->RendererFrameNumber();
563 child_event.type = blink::WebInputEvent::MouseDown;
564 child_event.button = blink::WebPointerProperties::ButtonLeft;
565 child_event.x = 75;
566 child_event.y = 75;
567 child_event.clickCount = 1;
568 main_frame_monitor.ResetEventReceived();
kenrb 2015/10/22 17:17:47 Can we remove the reset on line 547? These two see
lfg 2015/10/22 17:20:44 Done.
569 child_frame_monitor.ResetEventReceived();
562 router->RouteMouseEvent(root_view, &child_event); 570 router->RouteMouseEvent(root_view, &child_event);
563 } 571 }
564 572
565 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 573 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
566 EXPECT_EQ(23, child_frame_monitor.event().x); 574 EXPECT_EQ(23, child_frame_monitor.event().x);
567 EXPECT_EQ(23, child_frame_monitor.event().y); 575 EXPECT_EQ(23, child_frame_monitor.event().y);
568 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 576 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
569 577
570 child_frame_monitor.ResetEventReceived(); 578 child_frame_monitor.ResetEventReceived();
571 main_frame_monitor.ResetEventReceived(); 579 main_frame_monitor.ResetEventReceived();
(...skipping 3020 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 3600
3593 // CursorMessageFilter::Wait() implicitly tests whether we receive a 3601 // CursorMessageFilter::Wait() implicitly tests whether we receive a
3594 // ViewHostMsg_SetCursor message from the renderer process, because it does 3602 // ViewHostMsg_SetCursor message from the renderer process, because it does
3595 // does not return otherwise. 3603 // does not return otherwise.
3596 filter->Wait(); 3604 filter->Wait();
3597 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); 3605 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID());
3598 } 3606 }
3599 #endif 3607 #endif
3600 3608
3601 } // namespace content 3609 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698