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

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

Issue 2567093003: 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 8224 matching lines...) Expand 10 before | Expand all | Expand 10 after
8826 load_observer.Wait(); 8846 load_observer.Wait();
8827 8847
8828 // Ensure that the iframe reuses its parent's process. 8848 // Ensure that the iframe reuses its parent's process.
8829 EXPECT_EQ(srcdoc_url, child->current_url()); 8849 EXPECT_EQ(srcdoc_url, child->current_url());
8830 EXPECT_EQ(root->current_frame_host()->GetSiteInstance(), 8850 EXPECT_EQ(root->current_frame_host()->GetSiteInstance(),
8831 child->current_frame_host()->GetSiteInstance()); 8851 child->current_frame_host()->GetSiteInstance());
8832 EXPECT_EQ(root->current_frame_host()->GetProcess(), 8852 EXPECT_EQ(root->current_frame_host()->GetProcess(),
8833 child->current_frame_host()->GetProcess()); 8853 child->current_frame_host()->GetProcess());
8834 } 8854 }
8835 8855
8856 // Test that MouseDown and MouseUp to the same coordinates do not result in
8857 // different coordinates after routing. See bug https://crbug.com/670253.
8858 #if defined(OS_ANDROID)
8859 // Browser process hit testing is not implemented on Android.
8860 // https://crbug.com/491334
8861 #define MAYBE_MouseClickWithNonIntegerScaleFactor \
8862 DISABLED_MouseClickWithNonIntegerScaleFactor
8863 #else
8864 #define MAYBE_MouseClickWithNonIntegerScaleFactor \
8865 MouseClickWithNonIntegerScaleFactor
8866 #endif
8867 IN_PROC_BROWSER_TEST_F(SitePerProcessNonIntegerScaleFactorBrowserTest,
8868 MAYBE_MouseClickWithNonIntegerScaleFactor) {
8869 GURL initial_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
8870 EXPECT_TRUE(NavigateToURL(shell(), initial_url));
8871
8872 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
8873 ->GetFrameTree()
8874 ->root();
8875
8876 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>(
8877 root->current_frame_host()->GetRenderWidgetHost()->GetView());
8878
8879 RenderWidgetHostInputEventRouter* router =
8880 static_cast<WebContentsImpl*>(shell()->web_contents())
8881 ->GetInputEventRouter();
8882
8883 // Create listener for input events.
8884 RenderWidgetHostMouseEventMonitor event_monitor(
8885 root->current_frame_host()->GetRenderWidgetHost());
8886
8887 blink::WebMouseEvent mouse_event;
8888 mouse_event.type = blink::WebInputEvent::MouseDown;
8889 mouse_event.button = blink::WebPointerProperties::Button::Left;
8890 mouse_event.x = 75;
8891 mouse_event.y = 75;
8892 mouse_event.clickCount = 1;
8893 event_monitor.ResetEventReceived();
8894 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
8895
8896 EXPECT_TRUE(event_monitor.EventWasReceived());
8897 gfx::Point mouse_down_coords =
8898 gfx::Point(event_monitor.event().x, event_monitor.event().y);
8899 event_monitor.ResetEventReceived();
8900
8901 mouse_event.type = blink::WebInputEvent::MouseUp;
8902 mouse_event.x = 75;
8903 mouse_event.y = 75;
8904 router->RouteMouseEvent(rwhv, &mouse_event, ui::LatencyInfo());
8905
8906 EXPECT_TRUE(event_monitor.EventWasReceived());
8907 EXPECT_EQ(mouse_down_coords,
8908 gfx::Point(event_monitor.event().x, event_monitor.event().y));
8909 }
8910
8836 } // namespace content 8911 } // 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