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

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

Issue 2578253002: Prevent coordinate transformation when targeting the root RWHV (Closed)
Patch Set: Created 4 years 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 | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 protected: 583 protected:
584 void SetUpCommandLine(base::CommandLine* command_line) override { 584 void SetUpCommandLine(base::CommandLine* command_line) override {
585 SitePerProcessBrowserTest::SetUpCommandLine(command_line); 585 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
586 command_line->AppendSwitchASCII( 586 command_line->AppendSwitchASCII(
587 switches::kForceDeviceScaleFactor, 587 switches::kForceDeviceScaleFactor,
588 base::StringPrintf("%f", kDeviceScaleFactor)); 588 base::StringPrintf("%f", kDeviceScaleFactor));
589 } 589 }
590 }; 590 };
591 591
592 //
593 // SitePerProcessNonIntegerScaleFactorBrowserTest
594 //
595
596 class SitePerProcessNonIntegerScaleFactorBrowserTest
597 : public SitePerProcessBrowserTest {
598 public:
599 const double kDeviceScaleFactor = 1.5;
600
601 SitePerProcessNonIntegerScaleFactorBrowserTest() {}
602
603 protected:
604 void SetUpCommandLine(base::CommandLine* command_line) override {
605 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
606 command_line->AppendSwitchASCII(
607 switches::kForceDeviceScaleFactor,
608 base::StringPrintf("%f", kDeviceScaleFactor));
609 }
610 };
611
592 // SitePerProcessIgnoreCertErrorsBrowserTest 612 // SitePerProcessIgnoreCertErrorsBrowserTest
593 613
594 class SitePerProcessIgnoreCertErrorsBrowserTest 614 class SitePerProcessIgnoreCertErrorsBrowserTest
595 : public SitePerProcessBrowserTest { 615 : public SitePerProcessBrowserTest {
596 public: 616 public:
597 SitePerProcessIgnoreCertErrorsBrowserTest() {} 617 SitePerProcessIgnoreCertErrorsBrowserTest() {}
598 618
599 protected: 619 protected:
600 void SetUpCommandLine(base::CommandLine* command_line) override { 620 void SetUpCommandLine(base::CommandLine* command_line) override {
601 SitePerProcessBrowserTest::SetUpCommandLine(command_line); 621 SitePerProcessBrowserTest::SetUpCommandLine(command_line);
(...skipping 8049 matching lines...) Expand 10 before | Expand all | Expand 10 after
8651 // Start a URLRequest to the same URL. This should succeed. This would have 8671 // Start a URLRequest to the same URL. This should succeed. This would have
8652 // hit the 20 seconds delay before https://crbug.com/657195 was fixed. 8672 // hit the 20 seconds delay before https://crbug.com/657195 was fixed.
8653 EXPECT_TRUE(NavigateToURL(shell(), page_url)); 8673 EXPECT_TRUE(NavigateToURL(shell(), page_url));
8654 EXPECT_EQ(page_url, shell()->web_contents()->GetLastCommittedURL()); 8674 EXPECT_EQ(page_url, shell()->web_contents()->GetLastCommittedURL());
8655 8675
8656 // Note: even if the test fails and for some reason, the test has not timed 8676 // Note: even if the test fails and for some reason, the test has not timed
8657 // out by this point, the test teardown code will still hit a DCHECK when it 8677 // out by this point, the test teardown code will still hit a DCHECK when it
8658 // calls AssertNoURLRequests() in the shell's URLRequestContext destructor. 8678 // calls AssertNoURLRequests() in the shell's URLRequestContext destructor.
8659 } 8679 }
8660 8680
8681 // Test that MouseDown and MouseUp to the same coordinates do not result in
8682 // different coordinates after routing. See bug https://crbug.com/670253.
8683 #if defined(OS_ANDROID)
8684 // Browser process hit testing is not implemented on Android.
8685 // https://crbug.com/491334
8686 #define MAYBE_MouseClickWithNonIntegerScaleFactor \
8687 DISABLED_MouseClickWithNonIntegerScaleFactor
8688 #else
8689 #define MAYBE_MouseClickWithNonIntegerScaleFactor \
8690 MouseClickWithNonIntegerScaleFactor
8691 #endif
8692 IN_PROC_BROWSER_TEST_F(SitePerProcessNonIntegerScaleFactorBrowserTest,
8693 MAYBE_MouseClickWithNonIntegerScaleFactor) {
8694 GURL initial_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
8695 EXPECT_TRUE(NavigateToURL(shell(), initial_url));
8696
8697 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
8698 ->GetFrameTree()
8699 ->root();
8700
8701 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>(
8702 root->current_frame_host()->GetRenderWidgetHost()->GetView());
8703
8704 RenderWidgetHostInputEventRouter* router =
8705 static_cast<WebContentsImpl*>(shell()->web_contents())
8706 ->GetInputEventRouter();
8707
8708 // Create listener for input events.
8709 RenderWidgetHostMouseEventMonitor event_monitor(
8710 root->current_frame_host()->GetRenderWidgetHost());
8711
8712 blink::WebMouseEvent mouse_event;
8713 mouse_event.type = blink::WebInputEvent::MouseDown;
8714 mouse_event.button = blink::WebPointerProperties::Button::Left;
8715 mouse_event.x = 75;
8716 mouse_event.y = 75;
8717 mouse_event.clickCount = 1;
8718 event_monitor.ResetEventReceived();
8719 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
8720
8721 EXPECT_TRUE(event_monitor.EventWasReceived());
8722 gfx::Point mouse_down_coords =
8723 gfx::Point(event_monitor.event().x, event_monitor.event().y);
8724 event_monitor.ResetEventReceived();
8725
8726 mouse_event.type = blink::WebInputEvent::MouseUp;
8727 mouse_event.x = 75;
8728 mouse_event.y = 75;
8729 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
8730
8731 EXPECT_TRUE(event_monitor.EventWasReceived());
8732 EXPECT_EQ(mouse_down_coords,
8733 gfx::Point(event_monitor.event().x, event_monitor.event().y));
8734 }
8735
8661 } // namespace content 8736 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698