| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const std::string& name) { | 91 const std::string& name) { |
| 91 bool success = false; | 92 bool success = false; |
| 92 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 93 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 93 caller_frame, | 94 caller_frame, |
| 94 "window.domAutomationController.send(" | 95 "window.domAutomationController.send(" |
| 95 " !!window.open('" + url.spec() + "', '" + name + "'));", | 96 " !!window.open('" + url.spec() + "', '" + name + "'));", |
| 96 &success)); | 97 &success)); |
| 97 EXPECT_TRUE(success); | 98 EXPECT_TRUE(success); |
| 98 } | 99 } |
| 99 | 100 |
| 101 class RenderWidgetHostMouseEventMonitor { |
| 102 public: |
| 103 explicit RenderWidgetHostMouseEventMonitor(RenderWidgetHost* host) |
| 104 : host_(host), event_received_(false) { |
| 105 host_->AddMouseEventCallback( |
| 106 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, |
| 107 base::Unretained(this))); |
| 108 } |
| 109 ~RenderWidgetHostMouseEventMonitor() { |
| 110 host_->RemoveMouseEventCallback( |
| 111 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, |
| 112 base::Unretained(this))); |
| 113 } |
| 114 bool EventWasReceived() const { return event_received_; } |
| 115 void ResetEventReceived() { event_received_ = false; } |
| 116 const blink::WebMouseEvent& event() const { return event_; } |
| 117 |
| 118 private: |
| 119 bool MouseEventCallback(const blink::WebMouseEvent& event) { |
| 120 event_received_ = true; |
| 121 event_ = event; |
| 122 return false; |
| 123 } |
| 124 RenderWidgetHost* host_; |
| 125 bool event_received_; |
| 126 blink::WebMouseEvent event_; |
| 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostMouseEventMonitor); |
| 129 }; |
| 130 |
| 131 // Helper function that performs a surface hittest. |
| 132 void SurfaceHitTestTestHelper( |
| 133 Shell* shell, |
| 134 net::test_server::EmbeddedTestServer* embedded_test_server) { |
| 135 if (!UseSurfacesEnabled()) |
| 136 return; |
| 137 |
| 138 GURL main_url(embedded_test_server->GetURL( |
| 139 "/frame_tree/page_with_positioned_frame.html")); |
| 140 NavigateToURL(shell, main_url); |
| 141 |
| 142 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 143 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell->web_contents()) |
| 144 ->GetFrameTree() |
| 145 ->root(); |
| 146 ASSERT_EQ(1U, root->child_count()); |
| 147 |
| 148 FrameTreeNode* child_node = root->child_at(0); |
| 149 GURL site_url(embedded_test_server->GetURL("baz.com", "/title1.html")); |
| 150 EXPECT_EQ(site_url, child_node->current_url()); |
| 151 EXPECT_NE(shell->web_contents()->GetSiteInstance(), |
| 152 child_node->current_frame_host()->GetSiteInstance()); |
| 153 |
| 154 // Create listeners for mouse events. |
| 155 RenderWidgetHostMouseEventMonitor main_frame_monitor( |
| 156 root->current_frame_host()->GetRenderWidgetHost()); |
| 157 RenderWidgetHostMouseEventMonitor child_frame_monitor( |
| 158 child_node->current_frame_host()->GetRenderWidgetHost()); |
| 159 |
| 160 RenderWidgetHostInputEventRouter* router = |
| 161 static_cast<WebContentsImpl*>(shell->web_contents()) |
| 162 ->GetInputEventRouter(); |
| 163 |
| 164 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 165 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 166 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
| 167 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 168 |
| 169 // We need to wait for a compositor frame from the child frame, at which |
| 170 // point its surface will be created. |
| 171 while (rwhv_child->RendererFrameNumber() <= 0) { |
| 172 // TODO(lazyboy): Find a better way to avoid sleeping like this. See |
| 173 // http://crbug.com/405282 for details. |
| 174 base::RunLoop run_loop; |
| 175 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 176 FROM_HERE, run_loop.QuitClosure(), |
| 177 base::TimeDelta::FromMilliseconds(10)); |
| 178 run_loop.Run(); |
| 179 } |
| 180 |
| 181 uint32_t cur_render_frame_number = root_view->RendererFrameNumber(); |
| 182 |
| 183 // Target input event to child frame. |
| 184 blink::WebMouseEvent child_event; |
| 185 child_event.type = blink::WebInputEvent::MouseDown; |
| 186 child_event.button = blink::WebPointerProperties::ButtonLeft; |
| 187 child_event.x = 75; |
| 188 child_event.y = 75; |
| 189 child_event.clickCount = 1; |
| 190 main_frame_monitor.ResetEventReceived(); |
| 191 child_frame_monitor.ResetEventReceived(); |
| 192 router->RouteMouseEvent(root_view, &child_event); |
| 193 |
| 194 while (!child_frame_monitor.EventWasReceived()) { |
| 195 // This is working around a big synchronization problem. It is very |
| 196 // difficult to know if we have received a compositor frame from the |
| 197 // main frame renderer *after* it received the child frame's surface |
| 198 // ID. Hit testing won't work until this happens. So if the hit test |
| 199 // fails then we wait for another frame to arrive and try again. |
| 200 // TODO(kenrb): We need a better way to do all of this, possibly coming |
| 201 // from http://crbug.com/405282. |
| 202 while (root_view->RendererFrameNumber() <= cur_render_frame_number) { |
| 203 base::RunLoop run_loop; |
| 204 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 205 FROM_HERE, run_loop.QuitClosure(), |
| 206 base::TimeDelta::FromMilliseconds(10)); |
| 207 run_loop.Run(); |
| 208 } |
| 209 cur_render_frame_number = root_view->RendererFrameNumber(); |
| 210 child_event.type = blink::WebInputEvent::MouseDown; |
| 211 child_event.button = blink::WebPointerProperties::ButtonLeft; |
| 212 child_event.x = 75; |
| 213 child_event.y = 75; |
| 214 child_event.clickCount = 1; |
| 215 main_frame_monitor.ResetEventReceived(); |
| 216 child_frame_monitor.ResetEventReceived(); |
| 217 router->RouteMouseEvent(root_view, &child_event); |
| 218 } |
| 219 |
| 220 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 221 EXPECT_EQ(23, child_frame_monitor.event().x); |
| 222 EXPECT_EQ(23, child_frame_monitor.event().y); |
| 223 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 224 |
| 225 child_frame_monitor.ResetEventReceived(); |
| 226 main_frame_monitor.ResetEventReceived(); |
| 227 |
| 228 // Target input event to main frame. |
| 229 blink::WebMouseEvent main_event; |
| 230 main_event.type = blink::WebInputEvent::MouseDown; |
| 231 main_event.button = blink::WebPointerProperties::ButtonLeft; |
| 232 main_event.x = 1; |
| 233 main_event.y = 1; |
| 234 main_event.clickCount = 1; |
| 235 // Ladies and gentlemen, THIS is the main_event! |
| 236 router->RouteMouseEvent(root_view, &main_event); |
| 237 |
| 238 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 239 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 240 EXPECT_EQ(1, main_frame_monitor.event().x); |
| 241 EXPECT_EQ(1, main_frame_monitor.event().y); |
| 242 } |
| 243 |
| 100 class RedirectNotificationObserver : public NotificationObserver { | 244 class RedirectNotificationObserver : public NotificationObserver { |
| 101 public: | 245 public: |
| 102 // Register to listen for notifications of the given type from either a | 246 // Register to listen for notifications of the given type from either a |
| 103 // specific source, or from all sources if |source| is | 247 // specific source, or from all sources if |source| is |
| 104 // NotificationService::AllSources(). | 248 // NotificationService::AllSources(). |
| 105 RedirectNotificationObserver(int notification_type, | 249 RedirectNotificationObserver(int notification_type, |
| 106 const NotificationSource& source); | 250 const NotificationSource& source); |
| 107 ~RedirectNotificationObserver() override; | 251 ~RedirectNotificationObserver() override; |
| 108 | 252 |
| 109 // Wait until the specified notification occurs. If the notification was | 253 // Wait until the specified notification occurs. If the notification was |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 base::CommandLine* command_line) { | 454 base::CommandLine* command_line) { |
| 311 IsolateAllSitesForTesting(command_line); | 455 IsolateAllSitesForTesting(command_line); |
| 312 }; | 456 }; |
| 313 | 457 |
| 314 void SitePerProcessBrowserTest::SetUpOnMainThread() { | 458 void SitePerProcessBrowserTest::SetUpOnMainThread() { |
| 315 host_resolver()->AddRule("*", "127.0.0.1"); | 459 host_resolver()->AddRule("*", "127.0.0.1"); |
| 316 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 460 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 317 SetupCrossSiteRedirector(embedded_test_server()); | 461 SetupCrossSiteRedirector(embedded_test_server()); |
| 318 } | 462 } |
| 319 | 463 |
| 464 // |
| 465 // SitePerProcessHighDPIBrowserTest |
| 466 // |
| 467 |
| 468 |
| 469 class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest { |
| 470 public: |
| 471 SitePerProcessHighDPIBrowserTest() {} |
| 472 |
| 473 protected: |
| 474 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 475 SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
| 476 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, |
| 477 base::StringPrintf("2")); |
| 478 } |
| 479 }; |
| 480 |
| 320 // Ensure that navigating subframes in --site-per-process mode works and the | 481 // Ensure that navigating subframes in --site-per-process mode works and the |
| 321 // correct documents are committed. | 482 // correct documents are committed. |
| 322 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { | 483 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) { |
| 323 GURL main_url(embedded_test_server()->GetURL( | 484 GURL main_url(embedded_test_server()->GetURL( |
| 324 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); | 485 "a.com", "/cross_site_iframe_factory.html?a(a,a(a,a(a)))")); |
| 325 NavigateToURL(shell(), main_url); | 486 NavigateToURL(shell(), main_url); |
| 326 | 487 |
| 327 // It is safe to obtain the root frame tree node here, as it doesn't change. | 488 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 328 FrameTreeNode* root = | 489 FrameTreeNode* root = |
| 329 static_cast<WebContentsImpl*>(shell()->web_contents())-> | 490 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 " |--Site C ------- proxies for A\n" | 600 " |--Site C ------- proxies for A\n" |
| 440 " +--Site A ------- proxies for C\n" | 601 " +--Site A ------- proxies for C\n" |
| 441 " |--Site A -- proxies for C\n" | 602 " |--Site A -- proxies for C\n" |
| 442 " +--Site A -- proxies for C\n" | 603 " +--Site A -- proxies for C\n" |
| 443 " +--Site A -- proxies for C\n" | 604 " +--Site A -- proxies for C\n" |
| 444 "Where A = http://a.com/\n" | 605 "Where A = http://a.com/\n" |
| 445 " C = http://bar.com/", | 606 " C = http://bar.com/", |
| 446 DepictFrameTree(root)); | 607 DepictFrameTree(root)); |
| 447 } | 608 } |
| 448 | 609 |
| 449 class RenderWidgetHostMouseEventMonitor { | |
| 450 public: | |
| 451 RenderWidgetHostMouseEventMonitor(RenderWidgetHost* host) | |
| 452 : host_(host), event_received(false) { | |
| 453 host_->AddMouseEventCallback( | |
| 454 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, | |
| 455 base::Unretained(this))); | |
| 456 } | |
| 457 ~RenderWidgetHostMouseEventMonitor() { | |
| 458 host_->RemoveMouseEventCallback( | |
| 459 base::Bind(&RenderWidgetHostMouseEventMonitor::MouseEventCallback, | |
| 460 base::Unretained(this))); | |
| 461 } | |
| 462 bool EventWasReceived() { return event_received; } | |
| 463 void ResetEventReceived() { event_received = false; } | |
| 464 const blink::WebMouseEvent& event() const { return event_; } | |
| 465 | |
| 466 private: | |
| 467 bool MouseEventCallback(const blink::WebMouseEvent& event) { | |
| 468 event_received = true; | |
| 469 event_ = event; | |
| 470 return false; | |
| 471 } | |
| 472 RenderWidgetHost* host_; | |
| 473 bool event_received; | |
| 474 blink::WebMouseEvent event_; | |
| 475 }; | |
| 476 | |
| 477 // Test that mouse events are being routed to the correct RenderWidgetHostView | 610 // Test that mouse events are being routed to the correct RenderWidgetHostView |
| 478 // based on coordinates. | 611 // based on coordinates. |
| 479 #if defined(OS_ANDROID) | 612 #if defined(OS_ANDROID) |
| 480 // Browser process hit testing is not implemented on Android. | 613 // Browser process hit testing is not implemented on Android. |
| 481 // https://crbug.com/491334 | 614 // https://crbug.com/491334 |
| 482 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest | 615 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 483 #else | 616 #else |
| 484 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest | 617 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest |
| 485 #endif | 618 #endif |
| 486 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { | 619 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_SurfaceHitTestTest) { |
| 487 if (!UseSurfacesEnabled()) | 620 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 488 return; | 621 } |
| 489 | 622 |
| 490 GURL main_url(embedded_test_server()->GetURL( | 623 // Same test as above, but runs in high-dpi mode. |
| 491 "/frame_tree/page_with_positioned_frame.html")); | 624 #if defined(OS_ANDROID) || defined(OS_WIN) |
| 492 NavigateToURL(shell(), main_url); | 625 // Browser process hit testing is not implemented on Android. |
| 493 | 626 // https://crbug.com/491334 |
| 494 // It is safe to obtain the root frame tree node here, as it doesn't change. | 627 // Windows is disabled because of https://crbug.com/545547. |
| 495 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 628 #define MAYBE_HighDPISurfaceHitTestTest DISABLED_SurfaceHitTestTest |
| 496 ->GetFrameTree() | 629 #else |
| 497 ->root(); | 630 #define MAYBE_HighDPISurfaceHitTestTest SurfaceHitTestTest |
| 498 ASSERT_EQ(1U, root->child_count()); | 631 #endif |
| 499 | 632 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 500 FrameTreeNode* child_node = root->child_at(0); | 633 MAYBE_HighDPISurfaceHitTestTest) { |
| 501 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html")); | 634 SurfaceHitTestTestHelper(shell(), embedded_test_server()); |
| 502 EXPECT_EQ(site_url, child_node->current_url()); | |
| 503 EXPECT_NE(shell()->web_contents()->GetSiteInstance(), | |
| 504 child_node->current_frame_host()->GetSiteInstance()); | |
| 505 | |
| 506 // Create listeners for mouse events. | |
| 507 RenderWidgetHostMouseEventMonitor main_frame_monitor( | |
| 508 root->current_frame_host()->GetRenderWidgetHost()); | |
| 509 RenderWidgetHostMouseEventMonitor child_frame_monitor( | |
| 510 child_node->current_frame_host()->GetRenderWidgetHost()); | |
| 511 | |
| 512 RenderWidgetHostInputEventRouter* router = | |
| 513 static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 514 ->GetInputEventRouter(); | |
| 515 | |
| 516 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | |
| 517 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 518 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( | |
| 519 child_node->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 520 | |
| 521 // We need to wait for a compositor frame from the child frame, at which | |
| 522 // point its surface will be created. | |
| 523 while (rwhv_child->RendererFrameNumber() <= 0) { | |
| 524 // TODO(lazyboy): Find a better way to avoid sleeping like this. See | |
| 525 // http://crbug.com/405282 for details. | |
| 526 base::RunLoop run_loop; | |
| 527 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 528 FROM_HERE, run_loop.QuitClosure(), | |
| 529 base::TimeDelta::FromMilliseconds(10)); | |
| 530 run_loop.Run(); | |
| 531 } | |
| 532 | |
| 533 uint32_t cur_render_frame_number = root_view->RendererFrameNumber(); | |
| 534 | |
| 535 // Target input event to child frame. | |
| 536 blink::WebMouseEvent child_event; | |
| 537 child_event.type = blink::WebInputEvent::MouseDown; | |
| 538 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 539 child_event.x = 75; | |
| 540 child_event.y = 75; | |
| 541 child_event.clickCount = 1; | |
| 542 main_frame_monitor.ResetEventReceived(); | |
| 543 child_frame_monitor.ResetEventReceived(); | |
| 544 router->RouteMouseEvent(root_view, &child_event); | |
| 545 | |
| 546 while (!child_frame_monitor.EventWasReceived()) { | |
| 547 // This is working around a big synchronization problem. It is very | |
| 548 // difficult to know if we have received a compositor frame from the | |
| 549 // main frame renderer *after* it received the child frame's surface | |
| 550 // ID. Hit testing won't work until this happens. So if the hit test | |
| 551 // fails then we wait for another frame to arrive and try again. | |
| 552 // TODO(kenrb): We need a better way to do all of this, possibly coming | |
| 553 // from http://crbug.com/405282. | |
| 554 while (root_view->RendererFrameNumber() <= cur_render_frame_number) { | |
| 555 base::RunLoop run_loop; | |
| 556 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 557 FROM_HERE, run_loop.QuitClosure(), | |
| 558 base::TimeDelta::FromMilliseconds(10)); | |
| 559 run_loop.Run(); | |
| 560 } | |
| 561 cur_render_frame_number = root_view->RendererFrameNumber(); | |
| 562 child_event.type = blink::WebInputEvent::MouseDown; | |
| 563 child_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 564 child_event.x = 75; | |
| 565 child_event.y = 75; | |
| 566 child_event.clickCount = 1; | |
| 567 main_frame_monitor.ResetEventReceived(); | |
| 568 child_frame_monitor.ResetEventReceived(); | |
| 569 router->RouteMouseEvent(root_view, &child_event); | |
| 570 } | |
| 571 | |
| 572 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | |
| 573 EXPECT_EQ(23, child_frame_monitor.event().x); | |
| 574 EXPECT_EQ(23, child_frame_monitor.event().y); | |
| 575 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | |
| 576 | |
| 577 child_frame_monitor.ResetEventReceived(); | |
| 578 main_frame_monitor.ResetEventReceived(); | |
| 579 | |
| 580 // Target input event to main frame. | |
| 581 blink::WebMouseEvent main_event; | |
| 582 main_event.type = blink::WebInputEvent::MouseDown; | |
| 583 main_event.button = blink::WebPointerProperties::ButtonLeft; | |
| 584 main_event.x = 1; | |
| 585 main_event.y = 1; | |
| 586 main_event.clickCount = 1; | |
| 587 // Ladies and gentlemen, THIS is the main_event! | |
| 588 router->RouteMouseEvent(root_view, &main_event); | |
| 589 | |
| 590 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | |
| 591 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | |
| 592 EXPECT_EQ(1, main_frame_monitor.event().x); | |
| 593 EXPECT_EQ(1, main_frame_monitor.event().y); | |
| 594 } | 635 } |
| 595 | 636 |
| 596 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 637 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| 597 // OnSwapCompositorFrame message. | 638 // OnSwapCompositorFrame message. |
| 598 #if defined(OS_ANDROID) | 639 #if defined(OS_ANDROID) |
| 599 // http://crbug.com/471850 | 640 // http://crbug.com/471850 |
| 600 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 641 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
| 601 #else | 642 #else |
| 602 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped | 643 #define MAYBE_CompositorFrameSwapped CompositorFrameSwapped |
| 603 #endif | 644 #endif |
| (...skipping 3016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3620 | 3661 |
| 3621 // Use new window to navigate main window. | 3662 // Use new window to navigate main window. |
| 3622 std::string script = | 3663 std::string script = |
| 3623 "window.opener.location.href = '" + cross_url.spec() + "'"; | 3664 "window.opener.location.href = '" + cross_url.spec() + "'"; |
| 3624 EXPECT_TRUE(ExecuteScript(popup->web_contents(), script)); | 3665 EXPECT_TRUE(ExecuteScript(popup->web_contents(), script)); |
| 3625 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 3666 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
| 3626 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), cross_url); | 3667 EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), cross_url); |
| 3627 } | 3668 } |
| 3628 | 3669 |
| 3629 } // namespace content | 3670 } // namespace content |
| OLD | NEW |