| 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 <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 23 matching lines...) Expand all Loading... |
| 34 #include "content/public/test/test_navigation_observer.h" | 34 #include "content/public/test/test_navigation_observer.h" |
| 35 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 36 #include "content/shell/browser/shell.h" | 36 #include "content/shell/browser/shell.h" |
| 37 #include "content/test/content_browser_test_utils_internal.h" | 37 #include "content/test/content_browser_test_utils_internal.h" |
| 38 #include "content/test/test_frame_navigation_observer.h" | 38 #include "content/test/test_frame_navigation_observer.h" |
| 39 #include "ipc/ipc_security_test_util.h" | 39 #include "ipc/ipc_security_test_util.h" |
| 40 #include "net/dns/mock_host_resolver.h" | 40 #include "net/dns/mock_host_resolver.h" |
| 41 #include "net/test/embedded_test_server/embedded_test_server.h" | 41 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 42 #include "third_party/WebKit/public/web/WebInputEvent.h" | 42 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 43 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 43 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 44 #include "ui/gfx/switches.h" |
| 44 | 45 |
| 45 namespace content { | 46 namespace content { |
| 46 | 47 |
| 47 namespace { | 48 namespace { |
| 48 | 49 |
| 49 // Helper function to send a postMessage and wait for a reply message. The | 50 // Helper function to send a postMessage and wait for a reply message. The |
| 50 // |post_message_script| is executed on the |sender_ftn| frame, and the sender | 51 // |post_message_script| is executed on the |sender_ftn| frame, and the sender |
| 51 // frame is expected to post |reply_status| from the DOMAutomationController | 52 // frame is expected to post |reply_status| from the DOMAutomationController |
| 52 // when it receives a reply. | 53 // when it receives a reply. |
| 53 void PostMessageAndWaitForReply(FrameTreeNode* sender_ftn, | 54 void PostMessageAndWaitForReply(FrameTreeNode* sender_ftn, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // hit-testing. | 103 // hit-testing. |
| 103 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { | 104 void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { |
| 104 blink::WebMouseEvent mouse_event; | 105 blink::WebMouseEvent mouse_event; |
| 105 mouse_event.type = blink::WebInputEvent::MouseDown; | 106 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 106 mouse_event.button = blink::WebPointerProperties::ButtonLeft; | 107 mouse_event.button = blink::WebPointerProperties::ButtonLeft; |
| 107 mouse_event.x = x; | 108 mouse_event.x = x; |
| 108 mouse_event.y = y; | 109 mouse_event.y = y; |
| 109 rwh->ForwardMouseEvent(mouse_event); | 110 rwh->ForwardMouseEvent(mouse_event); |
| 110 } | 111 } |
| 111 | 112 |
| 113 class RenderWidgetHostMouseEventMonitor { |
| 114 public: |
| 115 explicit RenderWidgetHostMouseEventMonitor(RenderWidgetHost* host) |
| 116 : host_(host), event_received_(false) { |
| 117 host_->AddMouseEventCallback( |
| 118 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, |
| 119 base::Unretained(this))); |
| 120 } |
| 121 ~RenderWidgetHostMouseEventMonitor() { |
| 122 host_->RemoveMouseEventCallback( |
| 123 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, |
| 124 base::Unretained(this))); |
| 125 } |
| 126 bool EventWasReceived() const { return event_received_; } |
| 127 void ResetEventReceived() { event_received_ = false; } |
| 128 const blink::WebMouseEvent& event() const { return event_; } |
| 129 |
| 130 private: |
| 131 bool MouseEventCallback(const blink::WebMouseEvent& event) { |
| 132 event_received_ = true; |
| 133 event_ = event; |
| 134 return false; |
| 135 } |
| 136 RenderWidgetHost* host_; |
| 137 bool event_received_; |
| 138 blink::WebMouseEvent event_; |
| 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostMouseEventMonitor); |
| 141 }; |
| 142 |
| 143 // Helper function that performs a surface hittest. |
| 144 void SurfaceHitTestTestHelper( |
| 145 Shell* shell, |
| 146 net::test_server::EmbeddedTestServer* embedded_test_server) { |
| 147 if (!UseSurfacesEnabled()) |
| 148 return; |
| 149 |
| 150 GURL main_url(embedded_test_server->GetURL( |
| 151 "/frame_tree/page_with_positioned_frame.html")); |
| 152 NavigateToURL(shell, main_url); |
| 153 |
| 154 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 155 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell->web_contents()) |
| 156 ->GetFrameTree() |
| 157 ->root(); |
| 158 ASSERT_EQ(1U, root->child_count()); |
| 159 |
| 160 FrameTreeNode* child_node = root->child_at(0); |
| 161 GURL site_url(embedded_test_server->GetURL("baz.com", "/title1.html")); |
| 162 EXPECT_EQ(site_url, child_node->current_url()); |
| 163 EXPECT_NE(shell->web_contents()->GetSiteInstance(), |
| 164 child_node->current_frame_host()->GetSiteInstance()); |
| 165 |
| 166 // Create listeners for mouse events. |
| 167 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 168 root->current_frame_host()->GetRenderWidgetHost()); |
| 169 RenderWidgetHostMouseEventMonitor child_frame_monitor( |
| 170 child_node->current_frame_host()->GetRenderWidgetHost()); |
| 171 |
| 172 RenderWidgetHostInputEventRouter* router = |
| 173 static_cast<WebContentsImpl*>(shell->web_contents()) |
| 174 ->GetInputEventRouter(); |
| 175 |
| 176 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 177 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 178 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 179 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 180 |
| 181 // We need to wait for a compositor frame from the child frame, at which |
| 182 // point its surface will be created. |
| 183 while (rwhv_child->RendererFrameNumber() <= 0) { |
| 184 // TODO(lazyboy): Find a better way to avoid sleeping like this. See |
| 185 // http://crbug.com/405282 for details. |
| 186 base::RunLoop run_loop; |
| 187 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 188 FROM_HERE, run_loop.QuitClosure(), |
| 189 base::TimeDelta::FromMilliseconds(10)); |
| 190 run_loop.Run(); |
| 191 } |
| 192 |
| 193 uint32_t cur_render_frame_number = root_view->RendererFrameNumber(); |
| 194 |
| 195 // Target input event to child frame. |
| 196 blink::WebMouseEvent child_event; |
| 197 child_event.type = blink::WebInputEvent::MouseDown; |
| 198 child_event.button = blink::WebPointerProperties::ButtonLeft; |
| 199 child_event.x = 75; |
| 200 child_event.y = 75; |
| 201 child_event.clickCount = 1; |
| 202 main_frame_monitor.ResetEventReceived(); |
| 203 child_frame_monitor.ResetEventReceived(); |
| 204 router->RouteMouseEvent(root_view, &child_event); |
| 205 |
| 206 while (!child_frame_monitor.EventWasReceived()) { |
| 207 // This is working around a big synchronization problem. It is very |
| 208 // difficult to know if we have received a compositor frame from the |
| 209 // main frame renderer *after* it received the child frame's surface |
| 210 // ID. Hit testing won't work until this happens. So if the hit test |
| 211 // fails then we wait for another frame to arrive and try again. |
| 212 // TODO(kenrb): We need a better way to do all of this, possibly coming |
| 213 // from http://crbug.com/405282. |
| 214 while (root_view->RendererFrameNumber() <= cur_render_frame_number) { |
| 215 base::RunLoop run_loop; |
| 216 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 217 FROM_HERE, run_loop.QuitClosure(), |
| 218 base::TimeDelta::FromMilliseconds(10)); |
| 219 run_loop.Run(); |
| 220 } |
| 221 cur_render_frame_number = root_view->RendererFrameNumber(); |
| 222 child_event.type = blink::WebInputEvent::MouseDown; |
| 223 child_event.button = blink::WebPointerProperties::ButtonLeft; |
| 224 child_event.x = 75; |
| 225 child_event.y = 75; |
| 226 child_event.clickCount = 1; |
| 227 main_frame_monitor.ResetEventReceived(); |
| 228 child_frame_monitor.ResetEventReceived(); |
| 229 router->RouteMouseEvent(root_view, &child_event); |
| 230 } |
| 231 |
| 232 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 233 EXPECT_EQ(23, child_frame_monitor.event().x); |
| 234 EXPECT_EQ(23, child_frame_monitor.event().y); |
| 235 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 236 |
| 237 child_frame_monitor.ResetEventReceived(); |
| 238 main_frame_monitor.ResetEventReceived(); |
| 239 |
| 240 // Target input event to main frame. |
| 241 blink::WebMouseEvent main_event; |
| 242 main_event.type = blink::WebInputEvent::MouseDown; |
| 243 main_event.button = blink::WebPointerProperties::ButtonLeft; |
| 244 main_event.x = 1; |
| 245 main_event.y = 1; |
| 246 main_event.clickCount = 1; |
| 247 // Ladies and gentlemen, THIS is the main_event! |
| 248 router->RouteMouseEvent(root_view, &main_event); |
| 249 |
| 250 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 251 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 252 EXPECT_EQ(1, main_frame_monitor.event().x); |
| 253 EXPECT_EQ(1, main_frame_monitor.event().y); |
| 254 } |
| 255 |
| 112 class RedirectNotificationObserver : public NotificationObserver { | 256 class RedirectNotificationObserver : public NotificationObserver { |
| 113 public: | 257 public: |
| 114 // Register to listen for notifications of the given type from either a | 258 // Register to listen for notifications of the given type from either a |
| 115 // specific source, or from all sources if |source| is | 259 // specific source, or from all sources if |source| is |
| 116 // NotificationService::AllSources(). | 260 // NotificationService::AllSources(). |
| 117 RedirectNotificationObserver(int notification_type, | 261 RedirectNotificationObserver(int notification_type, |
| 118 const NotificationSource& source); | 262 const NotificationSource& source); |
| 119 ~RedirectNotificationObserver() override; | 263 ~RedirectNotificationObserver() override; |
| 120 | 264 |
| 121 // Wait until the specified notification occurs. If the notification was | 265 // Wait until the specified notification occurs. If the notification was |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 base::CommandLine* command_line) { | 466 base::CommandLine* command_line) { |
| 323 IsolateAllSitesForTesting(command_line); | 467 IsolateAllSitesForTesting(command_line); |
| 324 }; | 468 }; |
| 325 | 469 |
| 326 void SitePerProcessBrowserTest::SetUpOnMainThread() { | 470 void SitePerProcessBrowserTest::SetUpOnMainThread() { |
| 327 host_resolver()->AddRule("*", "127.0.0.1"); | 471 host_resolver()->AddRule("*", "127.0.0.1"); |
| 328 ASSERT_TRUE(embedded_test_server()->Start()); | 472 ASSERT_TRUE(embedded_test_server()->Start()); |
| 329 SetupCrossSiteRedirector(embedded_test_server()); | 473 SetupCrossSiteRedirector(embedded_test_server()); |
| 330 } | 474 } |
| 331 | 475 |
| 476 // |
| 477 // SitePerProcessHighDPIBrowserTest |
| 478 // |
| 479 |
| 480 |
| 481 class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest { |
| 482 public: |
| 483 SitePerProcessHighDPIBrowserTest() {} |
| 484 |
| 485 protected: |
| 486 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 487 SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
| 488 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, |
| 489 base::StringPrintf("2")); |
| 490 } |
| 491 }; |
| 492 |
| 332 // Ensure that navigating subframes in --site-per-process mode works and the | 493 // Ensure that navigating subframes in --site-per-process mode works and the |
| 333 // correct documents are committed. | 494 // correct documents are committed. |
| 334 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 495 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
| 335 GURL main_url(embedded_test_server()->GetURL( | 496 GURL main_url(embedded_test_server()->GetURL( |
| 336 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 497 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 337 NavigateToURL(shell(), main_url); | 498 NavigateToURL(shell(), main_url); |
| 338 | 499 |
| 339 // It is safe to obtain the root frame tree node here, as it doesn't change. | 500 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 340 FrameTreeNode* root = | 501 FrameTreeNode* root = |
| 341 static_cast<WebContentsImpl*>(shell()->web_contents())-> | 502 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 " |--Site C ------- proxies for A\n" | 612 " |--Site C ------- proxies for A\n" |
| 452 " +--Site A ------- proxies for C\n" | 613 " +--Site A ------- proxies for C\n" |
| 453 " |--Site A -- proxies for C\n" | 614 " |--Site A -- proxies for C\n" |
| 454 " +--Site A -- proxies for C\n" | 615 " +--Site A -- proxies for C\n" |
| 455 " +--Site A -- proxies for C\n" | 616 " +--Site A -- proxies for C\n" |
| 456 "Where A = http://a.com/\n" | 617 "Where A = http://a.com/\n" |
| 457 " C = http://bar.com/", | 618 " C = http://bar.com/", |
| 458 DepictFrameTree(root)); | 619 DepictFrameTree(root)); |
| 459 } | 620 } |
| 460 | 621 |
| 461 class RenderWidgetHostMouseEventMonitor { | |
| 462 public: | |
| 463 RenderWidgetHostMouseEventMonitor(RenderWidgetHost* host) | |
| 464 : host_(host), event_received(false) { | |
| 465 host_->AddMouseEventCallback( | |
| 466 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, | |
| 467 base::Unretained(this))); | |
| 468 } | |
| 469 ~RenderWidgetHostMouseEventMonitor() { | |
| 470 host_->RemoveMouseEventCallback( | |
| 471 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, | |
| 472 base::Unretained(this))); | |
| 473 } | |
| 474 bool EventWasReceived() { return event_received; } | |
| 475 void ResetEventReceived() { event_received = false; } | |
| 476 const blink::WebMouseEvent& event() const { return event_; } | |
| 477 | |
| 478 private: | |
| 479 bool MouseEventCallback(const blink::WebMouseEvent& event) { | |
| 480 event_received = true; | |
| 481 event_ = event; | |
| 482 return false; | |
| 483 } | |
| 484 RenderWidgetHost* host_; | |
| 485 bool event_received; | |
| 486 blink::WebMouseEvent event_; | |
| 487 }; | |
| 488 | |
| 489 // Test that mouse events are being routed to the correct RenderWidgetHostView | 622 // Test that mouse events are being routed to the correct RenderWidgetHostView |
| 490 // based on coordinates. | 623 // based on coordinates. |
| 491 #if defined(OS_ANDROID) | 624 #if defined(OS_ANDROID) |
| 492 // Browser process hit testing is not implemented on Android. | 625 // Browser process hit testing is not implemented on Android. |
| 493 // https://crbug.com/491334 | 626 // https://crbug.com/491334 |
| 494 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest | 627 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 495 #else | 628 #else |
| 496 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest | 629 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest |
| 497 #endif | 630 #endif |
| 498 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { | 631 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { |
| 499 if (!UseSurfacesEnabled()) | 632 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 500 return; | 633 } |
| 501 | 634 |
| 502 GURL main_url(embedded_test_server()->GetURL( | 635 // Same test as above, but runs in high-dpi mode. |
| 503 "/frame_tree/page_with_positioned_frame.html")); | 636 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 504 NavigateToURL(shell(), main_url); | 637 // Browser process hit testing is not implemented on Android. |
| 505 | 638 // https://crbug.com/491334 |
| 506 // It is safe to obtain the root frame tree node here, as it doesn't change. | 639 // Windows is disabled because of https://crbug.com/545547. |
| 507 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 640 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 508 ->GetFrameTree() | 641 #else |
| 509 ->root(); | 642 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest |
| 510 ASSERT_EQ(1U, root->child_count()); | 643 #endif |
| 511 | 644 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 512 FrameTreeNode* child_node = root->child_at(0); | 645 MAYBE_HighDPISurfaceHitTestTest) { |
| 513 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 646 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 514 EXPECT_EQ(site_url, child_node->current_url()); | |
| 515 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
| 516 child_node->current_frame_host()->GetSiteInstance()); | |
| 517 | |
| 518 // Create listeners for mouse events. | |
| 519 RenderWidgetHostMouseEventMonitor main_frame_monitor( | |
| 520 root->current_frame_host()->GetRenderWidgetHost()); | |
| 521 RenderWidgetHostMouseEventMonitor child_frame_monitor( | |
| 522 child_node->current_frame_host()->GetRenderWidgetHost()); | |
| 523 | |
| 524 RenderWidgetHostInputEventRouter* router = | |
| 525 static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 526 ->GetInputEventRouter(); | |
| 527 | |
| 528 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | |
| 529 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 530 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | |
| 531 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 532 | |
| 533 // We need to wait for a compositor frame from the child frame, at which | |
| 534 // point its surface will be created. | |
| 535 while (rwhv_child->RendererFrameNumber() <= 0) { | |
| 536 // TODO(lazyboy): Find a better way to avoid sleeping like this. See | |
| 537 // http://crbug.com/405282 for details. | |
| 538 base::RunLoop run_loop; | |
| 539 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 540 FROM_HERE, run_loop.QuitClosure(), | |
| 541 base::TimeDelta::FromMilliseconds(10)); | |
| 542 run_loop.Run(); | |
| 543 } | |
| 544 | |
| 545 uint32_t cur_render_frame_number = root_view->RendererFrameNumber(); | |
| 546 | |
| 547 // Target input event to child frame. | |
| 548 blink::WebMouseEvent child_event; | |
| 549 child_event.type = blink::WebInputEvent::MouseDown; | |
| 550 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 551 child_event.x = 75; | |
| 552 child_event.y = 75; | |
| 553 child_event.clickCount = 1; | |
| 554 main_frame_monitor.ResetEventReceived(); | |
| 555 child_frame_monitor.ResetEventReceived(); | |
| 556 router->RouteMouseEvent(root_view, &child_event); | |
| 557 | |
| 558 while (!child_frame_monitor.EventWasReceived()) { | |
| 559 // This is working around a big synchronization problem. It is very | |
| 560 // difficult to know if we have received a compositor frame from the | |
| 561 // main frame renderer *after* it received the child frame's surface | |
| 562 // ID. Hit testing won't work until this happens. So if the hit test | |
| 563 // fails then we wait for another frame to arrive and try again. | |
| 564 // TODO(kenrb): We need a better way to do all of this, possibly coming | |
| 565 // from http://crbug.com/405282. | |
| 566 while (root_view->RendererFrameNumber() <= cur_render_frame_number) { | |
| 567 base::RunLoop run_loop; | |
| 568 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 569 FROM_HERE, run_loop.QuitClosure(), | |
| 570 base::TimeDelta::FromMilliseconds(10)); | |
| 571 run_loop.Run(); | |
| 572 } | |
| 573 cur_render_frame_number = root_view->RendererFrameNumber(); | |
| 574 child_event.type = blink::WebInputEvent::MouseDown; | |
| 575 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 576 child_event.x = 75; | |
| 577 child_event.y = 75; | |
| 578 child_event.clickCount = 1; | |
| 579 main_frame_monitor.ResetEventReceived(); | |
| 580 child_frame_monitor.ResetEventReceived(); | |
| 581 router->RouteMouseEvent(root_view, &child_event); | |
| 582 } | |
| 583 | |
| 584 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | |
| 585 EXPECT_EQ(23, child_frame_monitor.event().x); | |
| 586 EXPECT_EQ(23, child_frame_monitor.event().y); | |
| 587 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | |
| 588 | |
| 589 child_frame_monitor.ResetEventReceived(); | |
| 590 main_frame_monitor.ResetEventReceived(); | |
| 591 | |
| 592 // Target input event to main frame. | |
| 593 blink::WebMouseEvent main_event; | |
| 594 main_event.type = blink::WebInputEvent::MouseDown; | |
| 595 main_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 596 main_event.x = 1; | |
| 597 main_event.y = 1; | |
| 598 main_event.clickCount = 1; | |
| 599 // Ladies and gentlemen, THIS is the main_event! | |
| 600 router->RouteMouseEvent(root_view, &main_event); | |
| 601 | |
| 602 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | |
| 603 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | |
| 604 EXPECT_EQ(1, main_frame_monitor.event().x); | |
| 605 EXPECT_EQ(1, main_frame_monitor.event().y); | |
| 606 } | 647 } |
| 607 | 648 |
| 608 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 649 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| 609 // OnSwapCompositorFrame message. | 650 // OnSwapCompositorFrame message. |
| 610 #if defined(OS_ANDROID) | 651 #if defined(OS_ANDROID) |
| 611 // http://crbug.com/471850 | 652 // http://crbug.com/471850 |
| 612 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 653 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
| 613 #else | 654 #else |
| 614 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 655 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
| 615 #endif | 656 #endif |
| (...skipping 3332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3948 SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); | 3989 SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); |
| 3949 | 3990 |
| 3950 // Verify that the input field in the subframe received the keystrokes. | 3991 // Verify that the input field in the subframe received the keystrokes. |
| 3951 EXPECT_TRUE(ExecuteScriptAndExtractString( | 3992 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 3952 root->child_at(0)->current_frame_host(), | 3993 root->child_at(0)->current_frame_host(), |
| 3953 "window.domAutomationController.send(getInputFieldText());", &result)); | 3994 "window.domAutomationController.send(getInputFieldText());", &result)); |
| 3954 EXPECT_EQ("FOO", result); | 3995 EXPECT_EQ("FOO", result); |
| 3955 } | 3996 } |
| 3956 | 3997 |
| 3957 } // namespace content | 3998 } // namespace content |
| OLD | NEW |