| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "content/test/content_browser_test_utils_internal.h" | 54 #include "content/test/content_browser_test_utils_internal.h" |
| 55 #include "content/test/test_frame_navigation_observer.h" | 55 #include "content/test/test_frame_navigation_observer.h" |
| 56 #include "ipc/ipc_security_test_util.h" | 56 #include "ipc/ipc_security_test_util.h" |
| 57 #include "net/dns/mock_host_resolver.h" | 57 #include "net/dns/mock_host_resolver.h" |
| 58 #include "net/test/embedded_test_server/embedded_test_server.h" | 58 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 59 #include "testing/gtest/include/gtest/gtest.h" | 59 #include "testing/gtest/include/gtest/gtest.h" |
| 60 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" | 60 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" |
| 61 #include "third_party/WebKit/public/web/WebInputEvent.h" | 61 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 62 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 62 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 63 #include "ui/display/display_switches.h" | 63 #include "ui/display/display_switches.h" |
| 64 #include "ui/display/screen.h" |
| 64 #include "ui/events/event.h" | 65 #include "ui/events/event.h" |
| 65 #include "ui/events/event_utils.h" | 66 #include "ui/events/event_utils.h" |
| 66 #include "ui/gfx/geometry/point.h" | 67 #include "ui/gfx/geometry/point.h" |
| 67 | 68 |
| 68 #if defined(USE_AURA) | 69 #if defined(USE_AURA) |
| 69 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 70 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
| 73 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" | 74 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 SetupCrossSiteRedirector(embedded_test_server()); | 583 SetupCrossSiteRedirector(embedded_test_server()); |
| 583 } | 584 } |
| 584 | 585 |
| 585 // | 586 // |
| 586 // SitePerProcessHighDPIBrowserTest | 587 // SitePerProcessHighDPIBrowserTest |
| 587 // | 588 // |
| 588 | 589 |
| 589 | 590 |
| 590 class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest { | 591 class SitePerProcessHighDPIBrowserTest : public SitePerProcessBrowserTest { |
| 591 public: | 592 public: |
| 593 const double kDeviceScaleFactor = 2.0; |
| 594 |
| 592 SitePerProcessHighDPIBrowserTest() {} | 595 SitePerProcessHighDPIBrowserTest() {} |
| 593 | 596 |
| 594 protected: | 597 protected: |
| 595 void SetUpCommandLine(base::CommandLine* command_line) override { | 598 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 596 SitePerProcessBrowserTest::SetUpCommandLine(command_line); | 599 SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
| 597 command_line->AppendSwitchASCII(switches::kForceDeviceScaleFactor, | 600 command_line->AppendSwitchASCII( |
| 598 base::StringPrintf("2")); | 601 switches::kForceDeviceScaleFactor, |
| 602 base::StringPrintf("%f", kDeviceScaleFactor)); |
| 599 } | 603 } |
| 600 }; | 604 }; |
| 601 | 605 |
| 602 // SitePerProcessIgnoreCertErrorsBrowserTest | 606 // SitePerProcessIgnoreCertErrorsBrowserTest |
| 603 | 607 |
| 604 class SitePerProcessIgnoreCertErrorsBrowserTest | 608 class SitePerProcessIgnoreCertErrorsBrowserTest |
| 605 : public SitePerProcessBrowserTest { | 609 : public SitePerProcessBrowserTest { |
| 606 public: | 610 public: |
| 607 SitePerProcessIgnoreCertErrorsBrowserTest() {} | 611 SitePerProcessIgnoreCertErrorsBrowserTest() {} |
| 608 | 612 |
| 609 protected: | 613 protected: |
| 610 void SetUpCommandLine(base::CommandLine* command_line) override { | 614 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 611 SitePerProcessBrowserTest::SetUpCommandLine(command_line); | 615 SitePerProcessBrowserTest::SetUpCommandLine(command_line); |
| 612 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 616 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
| 613 } | 617 } |
| 614 }; | 618 }; |
| 615 | 619 |
| 620 double GetFrameDeviceScaleFactor(const ToRenderFrameHost& adapter) { |
| 621 double device_scale_factor; |
| 622 const char kGetFrameDeviceScaleFactor[] = |
| 623 "window.domAutomationController.send(window.devicePixelRatio);"; |
| 624 EXPECT_TRUE(ExecuteScriptAndExtractDouble(adapter, kGetFrameDeviceScaleFactor, |
| 625 &device_scale_factor)); |
| 626 return device_scale_factor; |
| 627 } |
| 628 |
| 629 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
| 630 SubframeLoadsWithCorrectDeviceScaleFactor) { |
| 631 GURL main_url(embedded_test_server()->GetURL( |
| 632 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 633 NavigateToURL(shell(), main_url); |
| 634 |
| 635 EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor, |
| 636 GetFrameDeviceScaleFactor(web_contents())); |
| 637 |
| 638 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 639 FrameTreeNode* child = root->child_at(0); |
| 640 EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor, |
| 641 GetFrameDeviceScaleFactor(child)); |
| 642 } |
| 643 |
| 616 // Ensure that navigating subframes in --site-per-process mode works and the | 644 // Ensure that navigating subframes in --site-per-process mode works and the |
| 617 // correct documents are committed. | 645 // correct documents are committed. |
| 618 #if defined(OS_WIN) | 646 #if defined(OS_WIN) |
| 619 // This test is flaky on Windows, see https://crbug.com/629419. | 647 // This test is flaky on Windows, see https://crbug.com/629419. |
| 620 #define MAYBE_CrossSiteIframe DISABLED_CrossSiteIframe | 648 #define MAYBE_CrossSiteIframe DISABLED_CrossSiteIframe |
| 621 #else | 649 #else |
| 622 #define MAYBE_CrossSiteIframe CrossSiteIframe | 650 #define MAYBE_CrossSiteIframe CrossSiteIframe |
| 623 #endif | 651 #endif |
| 624 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_CrossSiteIframe) { | 652 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_CrossSiteIframe) { |
| 625 GURL main_url(embedded_test_server()->GetURL( | 653 GURL main_url(embedded_test_server()->GetURL( |
| (...skipping 7130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7756 // https://crbug.com/627893, recreating the opener RenderView was hitting a | 7784 // https://crbug.com/627893, recreating the opener RenderView was hitting a |
| 7757 // CHECK(params.swapped_out) in the renderer process, since its | 7785 // CHECK(params.swapped_out) in the renderer process, since its |
| 7758 // RenderViewHost was brought into an active state by the navigation to | 7786 // RenderViewHost was brought into an active state by the navigation to |
| 7759 // |stall_url| above, even though it never committed. | 7787 // |stall_url| above, even though it never committed. |
| 7760 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html")); | 7788 GURL b_url(embedded_test_server()->GetURL("b.com", "/title3.html")); |
| 7761 EXPECT_TRUE(NavigateToURL(popup_shell, b_url)); | 7789 EXPECT_TRUE(NavigateToURL(popup_shell, b_url)); |
| 7762 EXPECT_FALSE(rvh->is_active()); | 7790 EXPECT_FALSE(rvh->is_active()); |
| 7763 } | 7791 } |
| 7764 | 7792 |
| 7765 } // namespace content | 7793 } // namespace content |
| OLD | NEW |